From 3c83f9f4b01b5965e04739e5f8accf3235f8f699 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Mon, 20 Feb 2023 21:53:21 +0300 Subject: Add base crud actions for bundles --- Controllers/BundlesController.cs | 47 ---------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 Controllers/BundlesController.cs (limited to 'Controllers/BundlesController.cs') 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 -- cgit v1.2.3