From 71a3253a72fcd888a750c7e412c236603061c58c Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Wed, 22 Feb 2023 07:55:59 +0300 Subject: [PATCH] Bundle Controller refactoring --- Controllers/BundleController.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Controllers/BundleController.cs b/Controllers/BundleController.cs index 8e72dd3..fe52a6e 100644 --- a/Controllers/BundleController.cs +++ b/Controllers/BundleController.cs @@ -8,7 +8,6 @@ namespace MyDarling.Controllers public class BundleController : Controller { private DataContext context; - public bool TryUpdateModel { get; private set; } public BundleController(DataContext context) { @@ -46,7 +45,7 @@ namespace MyDarling.Controllers public async Task Details(int id) { - return View(await context.UnderwearBundles.FindAsync(id)); + return View(await context.UnderwearBundles.Include(b => b.Figures).Where(b => b.Id == id).FirstOrDefaultAsync()); } public async Task Edit(int id) @@ -71,7 +70,7 @@ namespace MyDarling.Controllers if (await TryUpdateModelAsync( bundle, "", - b => b.Name, b => b.Description, b => b.Price)) + b => b.Name, b => b.Description, b => b.Figures, b => b.Price)) { try {