0
0

Bundle Controller refactoring

This commit is contained in:
Sergey Chebotar 2023-02-22 07:55:59 +03:00
parent 44b78ff30c
commit 71a3253a72

View File

@ -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<ActionResult> 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<ActionResult> Edit(int id)
@ -71,7 +70,7 @@ namespace MyDarling.Controllers
if (await TryUpdateModelAsync<UnderwearBundle>(
bundle,
"",
b => b.Name, b => b.Description, b => b.Price))
b => b.Name, b => b.Description, b => b.Figures, b => b.Price))
{
try
{