чистый код, готова лаба 3 для пул реквеста
This commit is contained in:
parent
928feaa4c0
commit
c234c1a19d
@ -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)
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user