示例#1
0
        public void OnGet([FromServices] GetProducts getProducts, [FromServices] GetNews getNews)
        {
            News = getNews.Do().ToList();

            foreach (Shops shop in (Shops[])Enum.GetValues(typeof(Shops)))
            {
                var countSale = getProducts.CountProductOnSaleForShop(shop.ToString());

                if (countSale != 0)
                {
                    var shopVm = new ShopViewModel {
                        Name = shop.ToString(), SmallImagePath = $"{shop}-s.jpg", LargeImagePath = $"{shop}.jpg"
                    };
                    ProductsOnSale.Add(shop.ToString(), countSale);
                    Shops.Add(shopVm);
                }
            }
        }