-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProductCollectionHW.cs
106 lines (87 loc) · 3.53 KB
/
ProductCollectionHW.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AdvanceCsharpPrograms
{
public class ProductCollectionHW
{
public class ProductList
{
public int ProdId { get; set; }
public string ProdName { get; set; }
public int ProdPrice { get; set; }
}
public class CategoriesList
{
public int CategoriesCode { get; set; }
public string CategorieName { get; set; }
public List<ProductList> products=new List<ProductList>();
}
public static void Main(string[] args)
{
List<CategoriesList> categories = new List<CategoriesList>()
{
new CategoriesList
{
CategoriesCode=101,
CategorieName="Furniture",
products =
{
new ProductList{ProdId=202,ProdName="Chair",ProdPrice=2000},
new ProductList{ProdId=203,ProdName="Table",ProdPrice=4000},
new ProductList{ProdId=204,ProdName="Daining Table",ProdPrice=8000},
new ProductList{ProdId=205,ProdName="Laptop Table",ProdPrice=1000},
}
},
new CategoriesList
{
CategoriesCode=103,
CategorieName="Laptops",
products =
{
new ProductList{ProdId=103,ProdName="Dell Laptop",ProdPrice=45000},
new ProductList{ProdId=104,ProdName="HP Laptop",ProdPrice=50000},
new ProductList{ProdId=105,ProdName="Acer Laptop",ProdPrice=55000},
new ProductList{ProdId=106,ProdName="Lenovoe Laptop",ProdPrice=50000},
}
},
new CategoriesList
{
CategoriesCode=106,
CategorieName="Mens Wear",
products =
{
new ProductList{ProdId=108,ProdName="T-Shirts",ProdPrice=5000},
new ProductList{ProdId=109,ProdName="Jeans",ProdPrice=1000},
new ProductList{ProdId=110,ProdName="Smart Watchs",ProdPrice=2000},
}
},
new CategoriesList
{
CategoriesCode=122,
CategorieName="Womens Wear",
products =
{
new ProductList{ProdId=301,ProdName="Sarees",ProdPrice=1000},
new ProductList{ProdId=302,ProdName="T-Shirts",ProdPrice=500},
new ProductList{ProdId=303,ProdName="Jeans",ProdPrice=1000},
new ProductList{ProdId=304,ProdName="Skirt",ProdPrice=8000},
}
}
};
foreach(CategoriesList c in categories)
{
Console.WriteLine("Categorie Code: "+c.CategoriesCode);
Console.WriteLine("Categorie Name: "+c.CategorieName);
foreach(ProductList p in c.products)
{
Console.WriteLine("Product Id: " + p.ProdId);
Console.WriteLine("Product Name: " + p.ProdName);
Console.WriteLine("Product Price: "+p.ProdPrice);
}
}
}
}
}