Exemplo n.º 1
0
        public JsonResult UpdatePrise(int photo_id, int cart_itemqua)
        {
            int           i   = 0;
            AlbumDatabase mod = new AlbumDatabase();

            mod = repoc.detail(photo_id, repou.GetUserId(User.Identity.Name));
            if (mod.cart_itemqua > cart_itemqua)
            {
                i = repoc.DecreesCartItem(repou.GetUserId(User.Identity.Name), photo_id);
            }
            else
            {
                i = repoc.updateprise(photo_id, repou.GetUserId(User.Identity.Name));
            }

            if (i >= 0)
            {
                repo.UpdatesellQuantity(cart_itemqua, photo_id);
                int total_prise = repoc.totalPrise(repou.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);
            }
        }