public async Task <IActionResult> AddCart(int productId, int count) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account")); } var userId = this.GetUserId(); var result = await _shopProductRepository.AddCart(productId, userId, count); if (result.Succeed) { await _warehouseProductCheckRepository.AddFromShopOrder(new DataLayer.Entities.Warehouse.WarehouseProductCheck { Count = count, Date = DateTime.Now, ProductId = productId, TypeSSOt = DataLayer.SSOT.WarehouseTypeSSOT.Out, }); } TempData.AddResult(result); return(RedirectToAction("Index")); }
public async Task <IActionResult> AddCart(int productId, int count) { if (!User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account")); } var userId = this.GetUserId(); TempData.AddResult(await _shopProductRepository.AddCart(productId, userId, count)); return(RedirectToAction("Index")); }
public async Task <IActionResult> AddToShopOrder(int ProductId, int ShopOrderId, int Count, string urlBack) { var userId = this.GetUserId(); TempData.AddResult(await _shopProductRepository.AddCart(ShopOrderId, ProductId, userId, Count)); return(RedirectToAction(urlBack, new { id = ShopOrderId })); }