public ActionResult UpdateStoreQuantityItem(string storeCartItemId, string merchantId, string cartId, string quantity) { try { StoreGateway sg = new StoreGateway(); int quan = 0; if (!String.IsNullOrEmpty(quantity)) quan = Convert.ToInt32(quantity); bool success = sg.UpdateStoreQuantityItem(Convert.ToInt32(storeCartItemId), new Guid(cartId), quan); StoreShoppingCart cart = sg.GetShoppingCart(new Guid(cartId)); var store = cart.Stores.Where(x => x.MerchantId == new Guid(merchantId)).FirstOrDefault(); decimal itemTotals = 0.0M; decimal itemShipping = 0.0M; decimal totalAfterShipping = 0.0M; decimal price = 0.0M; if (store != null) { itemTotals = store.TotalPrice; itemShipping = store.TotalShipping; totalAfterShipping = store.TotalAfterShipping; price = store.StoreItems.Where(x => x.ShoppingCartItemId == Convert.ToInt32(storeCartItemId)).FirstOrDefault().Price; } this.AddItemToCart(HttpContext.Session, Convert.ToInt32(quantity)); return Json(new { IsSuccessful = true, itemPrice = "$" + price.ToString("N2"), subtotal = "$" + itemTotals.ToString("N2"), shipping = "$" + itemShipping.ToString("N2"), afterShipping = "$" + totalAfterShipping.ToString("N2") }, JsonRequestBehavior.AllowGet); } catch (Exception exception) { ErrorDatabaseManager.AddException(exception, exception.GetType(), additionalInformation: quantity); } return Json(new { IsSuccessful = false }, JsonRequestBehavior.AllowGet); }