чистый код, готова лаба 3 для пул реквеста

This commit is contained in:
ekallin 2024-03-11 09:27:23 +04:00
parent 928feaa4c0
commit c234c1a19d
2 changed files with 4 additions and 8 deletions

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;