diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-02-20 21:53:21 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-02-20 21:53:21 +0300 |
commit | 3c83f9f4b01b5965e04739e5f8accf3235f8f699 (patch) | |
tree | 8ec80ceaf26f1343ecccab682e9041689f4f5701 /Controllers/BundlesController.cs | |
parent | c740669676b30e5eae3cbadbef2810671b9e1c37 (diff) |
Add base crud actions for bundles
Diffstat (limited to 'Controllers/BundlesController.cs')
-rw-r--r-- | Controllers/BundlesController.cs | 47 |
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 |