diff --git a/DiningRoom/DiningRoomUserApp/Controllers/HomeController.cs b/DiningRoom/DiningRoomUserApp/Controllers/HomeController.cs index fa9280d..a423f80 100644 --- a/DiningRoom/DiningRoomUserApp/Controllers/HomeController.cs +++ b/DiningRoom/DiningRoomUserApp/Controllers/HomeController.cs @@ -228,6 +228,29 @@ namespace DiningRoomUserApp.Controllers Response.Redirect("Products"); } + public IActionResult DeleteProduct() + { + if (APIClient.User == null) + { + return Redirect("~/Home/Enter"); + } + ViewBag.Products = APIClient.GetRequest>($"api/main/getproductlist?userId={APIClient.User.Id}"); + return View(); + } + [HttpPost] + public void DeleteProduct(int product) + { + if (APIClient.User == null) + { + throw new Exception("Необходима авторизация"); + } + APIClient.PostRequest("api/main/deleteproduct", new ProductBindingModel + { + Id = product + }); + Response.Redirect("Products"); + } + [HttpGet] public IActionResult Privacy() { diff --git a/DiningRoom/DiningRoomUserApp/Views/Home/DeleteProduct.cshtml b/DiningRoom/DiningRoomUserApp/Views/Home/DeleteProduct.cshtml index b474fa4..081dd84 100644 --- a/DiningRoom/DiningRoomUserApp/Views/Home/DeleteProduct.cshtml +++ b/DiningRoom/DiningRoomUserApp/Views/Home/DeleteProduct.cshtml @@ -1,22 +1,22 @@ @{ - ViewData["Title"] = "DeleteRoom"; + ViewData["Title"] = "DeleteProduct"; }
-

Удалить комнату

+

Удалить блюдо

- - + +
\ No newline at end of file