From e4b4105ec0802dd0f1b735e5cb7fba083a0ffe0c Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Thu, 16 Feb 2023 08:28:59 +0300 Subject: Add edit page --- Controllers/BundlesController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'Controllers/BundlesController.cs') diff --git a/Controllers/BundlesController.cs b/Controllers/BundlesController.cs index 5c0fc0e..8b66139 100644 --- a/Controllers/BundlesController.cs +++ b/Controllers/BundlesController.cs @@ -1,4 +1,5 @@ using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using MyDarling.Models; namespace MyDarling.Controllers @@ -6,15 +7,20 @@ 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()); + } } } \ No newline at end of file -- cgit v1.2.3