Ejemplo n.º 1
0
        public JsonResult UpdatePrise(int photo_id, int cart_itemquantity)
        {
            int        i   = 0;
            PhotoModel mod = new PhotoModel();

            mod = cartRepo.detail(photo_id, userRepo.GetUserId(User.Identity.Name));
            if (mod.cart_itemquantity > cart_itemquantity)
            {
                i = cartRepo.DecreesCartItem(userRepo.GetUserId(User.Identity.Name), photo_id);
            }
            else
            {
                i = cartRepo.updateprise(photo_id, userRepo.GetUserId(User.Identity.Name));
            }

            if (i >= 0)
            {
                photorepo.UpdatesellQuantity(cart_itemquantity, photo_id);
                int total_prise = cartRepo.totalPrise(userRepo.GetUserId(User.Identity.Name), photo_id);
                var jsonResult  = Json(total_prise, JsonRequestBehavior.AllowGet);
                return(jsonResult);
            }
            else
            {
                var message    = "failed";
                var jsonResult = Json(message, JsonRequestBehavior.AllowGet);
                return(jsonResult);
            }
        }