diff options
author | Sergey Chebotar <s.chebotar@gmail.com> | 2023-02-16 08:46:04 +0300 |
---|---|---|
committer | Sergey Chebotar <s.chebotar@gmail.com> | 2023-02-16 08:46:04 +0300 |
commit | b20759f20589af855adb977079cf77b4ef299b13 (patch) | |
tree | 4cf8a700dd11b0c35500cc793399028cd00dec88 /Controllers/BundlesController.cs | |
parent | e4b4105ec0802dd0f1b735e5cb7fba083a0ffe0c (diff) |
Add delete action for bundles controller
Diffstat (limited to 'Controllers/BundlesController.cs')
-rw-r--r-- | Controllers/BundlesController.cs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Controllers/BundlesController.cs b/Controllers/BundlesController.cs index 8b66139..1f5c212 100644 --- a/Controllers/BundlesController.cs +++ b/Controllers/BundlesController.cs @@ -22,5 +22,15 @@ namespace MyDarling.Controllers { 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"); + } } }
\ No newline at end of file |