示例#1
0
 public IActionResult PostEditItem(ShopProduct product, string ShopId)
 {
     try
     {
         ViewData["ShopId"] = ShopId;
         _serviceFacade.EditProductInShop(new Guid(HttpContext.Session.Id), new Guid(ShopId), product.Guid, product.Price, product.Quantity);
         return(RedirectToAction("Products", "Seller", new { ShopId = ShopId }));
     }
     catch (NoPrivilegesException)
     {
         var redirect = this.Url.Action("Index", "Seller");
         var message  = new UserMessage(redirect, "You haven't sufficient priviliges. Cannot complete the request.");
         return(View("UserMessage", message));
     }
     catch (IllegalArgumentException)
     {
         var redirect = this.Url.Action("Index", "Seller");
         var message  = new UserMessage(redirect, "Please fill in all required fields in a valid manner.");
         return(View("UserMessage", message));
     }
     catch (GeneralServerError)
     {
         var redirect = this.Url.Action("Index", "Seller");
         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", "Seller");
         var message  = new UserMessage(redirect, "An error has occured. Please refresh and try again. (Database connection lost).");
         return(View("UserMessage", message));
     }
 }
示例#2
0
 public bool EditProductInShop(Guid userGuid, Guid shopGuid, Guid productGuid, double newPrice, int newQuantity)
 {
     return(_serviceFacade.EditProductInShop(userGuid, shopGuid, productGuid, newPrice, newQuantity));
 }