public IActionResult EditCartProduct(string shopGuid, string shopProductGuid, string newAmount) { try { _serviceFacade.EditProductInCart(new Guid(HttpContext.Session.Id), new Guid(shopGuid), new Guid(shopProductGuid), int.Parse(newAmount)); return(RedirectToAction("ShoppingCart", "Buyer")); } catch (ShopStateException) { var redirect = this.Url.Action("Index", "Buyer"); var message = new UserMessage(redirect, "Cannot edit a cart of a closed shop."); return(View("UserMessage", message)); } catch (GeneralServerError) { var redirect = this.Url.Action("Index", "Buyer"); var message = new UserMessage(redirect, "An error has occured. Please refresh and try again."); return(View("UserMessage", message)); } catch (DatabaseConnectionTimeoutException) { var redirect = this.Url.Action("Index", "Buyer"); var message = new UserMessage(redirect, "An error has occured. Please refresh and try again. (Database connection lost)."); return(View("UserMessage", message)); } }
public bool EditProductInCart(Guid userGuid, Guid shopGuid, Guid shopProductGuid, int newAmount) { return(_serviceFacade.EditProductInCart(userGuid, shopGuid, shopProductGuid, newAmount)); }