PIbd - 21 Bakalskaya E.D. LabWork03 HARD #15

Closed
ekallin wants to merge 10 commits from LabWork13 into LabWork12
2 changed files with 4 additions and 8 deletions
Showing only changes of commit c234c1a19d - Show all commits

View File

@ -28,7 +28,6 @@ namespace SushiBar
ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
//Application.Run(new Form1());
}
private static void ConfigureServices(ServiceCollection services)

View File

@ -45,11 +45,9 @@ namespace SushiBarDatabaseImplement.Implements
return context.Sushis
.Include(x => x.Components)
.ThenInclude(x => x.Component)
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.SushiName) &&
x.SushiName == model.SushiName) ||
(model.Id.HasValue && x.Id ==
model.Id))
?.GetViewModel;
.FirstOrDefault(x =>
(!string.IsNullOrEmpty(model.SushiName) && x.SushiName ==
model.SushiName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
}
public SushiViewModel? Insert(SushiBindingModel model)
{
@ -69,8 +67,7 @@ namespace SushiBarDatabaseImplement.Implements
using var transaction = context.Database.BeginTransaction();
try
{
var Sushi = context.Sushis.FirstOrDefault(rec =>
rec.Id == model.Id);
var Sushi = context.Sushis.FirstOrDefault(rec => rec.Id == model.Id);
if (Sushi == null)
{
return null;