public async Task <RedirectToRouteResult> AddToCart(Cart cart, int?productId, string returnUrl, int?quantity) { var listOfGoods = Mapper.Map <ListOfGoodsView>(await _listOfGoods.SelectId(productId)); if (quantity == 0 || quantity == null) { return(RedirectToAction("Сatalog", new { returnUrl })); } if (listOfGoods != null) { cart.AddItem(listOfGoods, quantity.Value); } return(RedirectToAction("Сatalog", new { returnUrl })); }
// GET: Price/Edit/5 public async Task <ActionResult> PriceListEdit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ListOfGoodsView listOfGoodsView = Mapper.Map <ListOfGoodsView>(await _listOfGoods.SelectId(id)); ViewBag.Categories = new SelectList(await _productCategories.GetTableAll(), "idProductСategories", "Name", listOfGoodsView.productCategoriesId); if (listOfGoodsView == null) { return(HttpNotFound()); } return(View(listOfGoodsView)); }