From dc58f242fa20f89cdbb0f4b80138be04c3e50c2e Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Thu, 16 Feb 2023 09:01:18 +0300 Subject: [PATCH] Add action for adding new bundles --- Controllers/BundlesController.cs | 11 +++++++++++ Views/Bundles/Add.cshtml | 33 ++++++++++++++++++++++++++++++++ Views/Bundles/Index.cshtml | 1 + 3 files changed, 45 insertions(+) create mode 100644 Views/Bundles/Add.cshtml diff --git a/Controllers/BundlesController.cs b/Controllers/BundlesController.cs index 1f5c212..aeefebb 100644 --- a/Controllers/BundlesController.cs +++ b/Controllers/BundlesController.cs @@ -32,5 +32,16 @@ namespace MyDarling.Controllers } return RedirectToAction("Index"); } + + public ActionResult Add() + { + return View(); + } + [HttpPost] + public ActionResult Add(UnderwearBundle b) + { + repository.Add(b); + return RedirectToAction("Index"); + } } } \ No newline at end of file diff --git a/Views/Bundles/Add.cshtml b/Views/Bundles/Add.cshtml new file mode 100644 index 0000000..81b3061 --- /dev/null +++ b/Views/Bundles/Add.cshtml @@ -0,0 +1,33 @@ +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers +@model MyDarling.Models.UnderwearBundle + + + + + + New bundle + + + + + +
+
+
+ + +
+
+ + +
+
+ + +
+ +
+
+ + + \ No newline at end of file diff --git a/Views/Bundles/Index.cshtml b/Views/Bundles/Index.cshtml index e93edb2..01c5a31 100644 --- a/Views/Bundles/Index.cshtml +++ b/Views/Bundles/Index.cshtml @@ -34,6 +34,7 @@ } + Add bundle