summaryrefslogtreecommitdiff
path: root/Controllers/BundlesController.cs
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-02-20 21:53:21 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-02-20 21:53:21 +0300
commit3c83f9f4b01b5965e04739e5f8accf3235f8f699 (patch)
tree8ec80ceaf26f1343ecccab682e9041689f4f5701 /Controllers/BundlesController.cs
parentc740669676b30e5eae3cbadbef2810671b9e1c37 (diff)
Add base crud actions for bundles
Diffstat (limited to 'Controllers/BundlesController.cs')
-rw-r--r--Controllers/BundlesController.cs47
1 files changed, 0 insertions, 47 deletions
diff --git a/Controllers/BundlesController.cs b/Controllers/BundlesController.cs
deleted file mode 100644
index aeefebb..0000000
--- a/Controllers/BundlesController.cs
+++ /dev/null
@@ -1,47 +0,0 @@
-using Microsoft.AspNetCore.Mvc;
-using Microsoft.EntityFrameworkCore;
-using MyDarling.Models;
-
-namespace MyDarling.Controllers
-{
- public class BundlesController : Controller
- {
- private IRepository repository;
-
- public BundlesController(IRepository repository)
- {
- this.repository = repository;
- }
-
- public ActionResult Index()
- {
- return View(repository);
- }
-
- public ActionResult Edit(int id)
- {
- return View(repository.Bundles.Where(b => b.Id == id).FirstOrDefault());
- }
-
- public ActionResult Delete(int id)
- {
- var bundle = repository.Bundles.Where(b => b.Id == id).FirstOrDefault();
- if (bundle != null)
- {
- repository.Remove(bundle);
- }
- 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