Добавлена возможность получения списка компонент из бд вместе с изделием
This commit is contained in:
parent
b18e9a142d
commit
f2ca847c6b
@ -4,6 +4,7 @@ using ConfectioneryContracts.StoragesContract;
|
|||||||
using ConfectioneryContracts.ViewModels;
|
using ConfectioneryContracts.ViewModels;
|
||||||
using ConfectioneryDatabaseImplement;
|
using ConfectioneryDatabaseImplement;
|
||||||
using ConfectioneryDatabaseImplement.Models;
|
using ConfectioneryDatabaseImplement.Models;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
|
||||||
namespace ConfectioneryDatabaseImplement.Implements
|
namespace ConfectioneryDatabaseImplement.Implements
|
||||||
{
|
{
|
||||||
@ -29,7 +30,10 @@ namespace ConfectioneryDatabaseImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new ConfectioneryDatabase();
|
using var context = new ConfectioneryDatabase();
|
||||||
return context.Pastries.FirstOrDefault
|
return context.Pastries
|
||||||
|
.Include(x => x.Components)
|
||||||
|
.ThenInclude(x => x.Component)
|
||||||
|
.FirstOrDefault
|
||||||
(x => (!string.IsNullOrEmpty(model.PastryName) && x.PastryName == model.PastryName) ||
|
(x => (!string.IsNullOrEmpty(model.PastryName) && x.PastryName == model.PastryName) ||
|
||||||
(model.Id.HasValue && x.Id == model.Id)
|
(model.Id.HasValue && x.Id == model.Id)
|
||||||
)?.GetViewModel;
|
)?.GetViewModel;
|
||||||
|
Loading…
Reference in New Issue
Block a user