Ejemplo n.º 1
0
        public IActionResult SetQuantity(int productid, int q)
        {
            var userid = Int32.Parse(User.FindFirstValue(ClaimTypes.NameIdentifier));

            _cart.ChangeQuantity(productid, userid, q);
            var listacart = _cart.GetAllCartItemsByUser(userid);
            List <LookInCartVM> listavm = listacart
                                          .Select(s => new LookInCartVM
            {
                ProductID       = s.ProductID,
                ProductNumber   = _database.product.Find(s.ProductID).ProductNumber,
                ProductName     = _database.product.Find(s.ProductID).ProductName,
                SubCategoryName = _database.subcategory.Find(_database.product.Find(s.ProductID).SubCategoryID).SubCategoryName,
                UnitPrice       = _database.product.Find(s.ProductID).UnitPrice,
                Quantity        = s.Quantity,
                ActualQuantity  = _database.product.Find(s.ProductID).UnitsInStock
            }
                                                  ).ToList();

            return(PartialView("GetCartItems", listavm));
        }
 public IActionResult SetQuantity(int productid, int userid, int q)
 {
     _cart.ChangeQuantity(productid, userid, q);
     //return Redirect("LookInCart");
     return(new EmptyResult());
 }