PhoneClass.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace wpf_template.Model
  7. {
  8. public class Product
  9. {
  10. public string Title { get; set; }
  11. public string Company { get; set; }
  12. public int Price { get; set; }
  13. public string Category { get; set; }
  14. public string Photo { get; set; }
  15. }
  16. public class ProductCategory
  17. {
  18. public string title { get; set; }
  19. }
  20. public class ProductPrice
  21. {
  22. public string title { get; set; }
  23. public int priceFrom { get; set; }
  24. public int priceTo { get; set; }
  25. }
  26. public class ProductCompany
  27. {
  28. public string title { get; set; }
  29. }
  30. interface IDataProvider
  31. {
  32. IEnumerable<Product> GetProducts();
  33. IEnumerable<ProductCategory> GetCategories();
  34. IEnumerable<ProductPrice> GetPrices();
  35. IEnumerable<ProductCompany> GetCompanies();
  36. }
  37. public class LocalDataProvider : IDataProvider
  38. {
  39. public IEnumerable<Product> GetProducts()
  40. {
  41. return new Product[]{
  42. new Product
  43. {
  44. Category = "Смартфон",
  45. Company = "Apple",
  46. Title = "13 Pro Max",
  47. Price = 84999
  48. },
  49. new Product
  50. {
  51. Category = "Смартфон",
  52. Company = "Samsung",
  53. Title = "S23",
  54. Price = 89999
  55. },
  56. new Product
  57. {
  58. Category = "Смартфон",
  59. Company = "Huawei",
  60. Title = "Nova Y61",
  61. Price = 9999
  62. },
  63. new Product
  64. {
  65. Category = "Смартфон",
  66. Company = "POCO",
  67. Title = "C51",
  68. Price = 5599
  69. },
  70. new Product
  71. {
  72. Category = "Ноутбук",
  73. Company = "Xiaomi",
  74. Title = "RedmiBook 15",
  75. Price = 49999
  76. },
  77. new Product
  78. {
  79. Category = "Ноутбук",
  80. Company = "Asus",
  81. Title = "Vivobook Go 15",
  82. Price = 25999
  83. },
  84. new Product
  85. {
  86. Category = "Ноутбук",
  87. Company = "Lenovo",
  88. Title = "IdeaPad 1",
  89. Price = 24999
  90. },
  91. new Product
  92. {
  93. Category = "Ноутбук",
  94. Company = "Asus",
  95. Title = "ExpertBook B1502",
  96. Price = 32999
  97. },
  98. new Product
  99. {
  100. Category = "Смарт-Часы",
  101. Company = "Apple",
  102. Title = "SE 2023",
  103. Price = 30599
  104. },
  105. new Product
  106. {
  107. Category = "Смарт-Часы",
  108. Company = "Xiaomi",
  109. Title = "Smart Band 8",
  110. Price = 3999
  111. },
  112. new Product
  113. {
  114. Category = "Смарт-Часы",
  115. Company = "Huawei",
  116. Title = "Watch GT 4",
  117. Price = 13999
  118. },
  119. };
  120. }
  121. public IEnumerable<ProductCategory> GetCategories()
  122. {
  123. return new ProductCategory[]
  124. {
  125. new ProductCategory {title = "Смартфон"},
  126. new ProductCategory {title = "Ноутбук"},
  127. new ProductCategory {title = "Смарт-Часы"},
  128. new ProductCategory {title = "Монитор"}
  129. };
  130. }
  131. public IEnumerable<ProductPrice> GetPrices()
  132. {
  133. return new ProductPrice[]
  134. {
  135. new ProductPrice{title="Все цены", priceFrom = 0, priceTo = 999999},
  136. new ProductPrice{title="До 10.000", priceFrom = 0, priceTo = 10000},
  137. new ProductPrice{title="От 10.000 до 20.000", priceFrom = 10000, priceTo = 20000},
  138. new ProductPrice{title="От 20.000 до 50.000", priceFrom = 20000, priceTo = 50000},
  139. new ProductPrice{title="Дороже 50.000", priceFrom = 50000, priceTo = 999999 }
  140. };
  141. }
  142. public IEnumerable<ProductCompany> GetCompanies()
  143. {
  144. return new ProductCompany[]
  145. {
  146. new ProductCompany{title = "Apple"},
  147. new ProductCompany{title = "Xiaomi"},
  148. new ProductCompany{title = "Huawei"},
  149. new ProductCompany{title = "POCO"},
  150. new ProductCompany{title = "Asus"},
  151. new ProductCompany{title = "Lenovo"},
  152. new ProductCompany{title = "Samsung"}
  153. };
  154. }
  155. }
  156. }