예제 #1
0
        // GET: Shop
        public async Task <ActionResult> Сatalog(Cart cart)
        {
            var listOfGoods = Mapper.Map <IEnumerable <ListOfGoodsView> >(await _listOfGoods.GetTableAll());
            var categories  = Mapper.Map <IEnumerable <ProductCategoriesView> >(await _productCategories.GetTableAll());

            if (cart.ComputeTotalValu() != 0)
            {
                ViewBag.Cart         = true;
                ViewBag.InfoQuantity = cart.Lines.Sum(x => x.Quantity);
                ViewBag.InfoSum      = cart.ComputeTotalValu().ToString();
            }
            else
            {
                ViewBag.Cart = false;
            }

            ViewBag.Categories = categories;
            return(View(listOfGoods));
        }
예제 #2
0
        // GET: Price
        public async Task <ActionResult> PriceList(int?idCategories = 1)
        {
            ViewBag.Categories = Mapper.Map <IEnumerable <ProductCategoriesView> >(await _productCategories.GetTableAll());

            return(View(Mapper.Map <IEnumerable <ListOfGoodsView> >(await _listOfGoods.GetTableAll(idCategories.Value))));
        }