чистый код, готова лаба 3 для пул реквеста
This commit is contained in:
parent
928feaa4c0
commit
c234c1a19d
@ -28,7 +28,6 @@ namespace SushiBar
|
|||||||
ConfigureServices(services);
|
ConfigureServices(services);
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||||
//Application.Run(new Form1());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
|
@ -45,11 +45,9 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
return context.Sushis
|
return context.Sushis
|
||||||
.Include(x => x.Components)
|
.Include(x => x.Components)
|
||||||
.ThenInclude(x => x.Component)
|
.ThenInclude(x => x.Component)
|
||||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.SushiName) &&
|
.FirstOrDefault(x =>
|
||||||
x.SushiName == model.SushiName) ||
|
(!string.IsNullOrEmpty(model.SushiName) && x.SushiName ==
|
||||||
(model.Id.HasValue && x.Id ==
|
model.SushiName) || (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
model.Id))
|
|
||||||
?.GetViewModel;
|
|
||||||
}
|
}
|
||||||
public SushiViewModel? Insert(SushiBindingModel model)
|
public SushiViewModel? Insert(SushiBindingModel model)
|
||||||
{
|
{
|
||||||
@ -69,8 +67,7 @@ namespace SushiBarDatabaseImplement.Implements
|
|||||||
using var transaction = context.Database.BeginTransaction();
|
using var transaction = context.Database.BeginTransaction();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var Sushi = context.Sushis.FirstOrDefault(rec =>
|
var Sushi = context.Sushis.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
rec.Id == model.Id);
|
|
||||||
if (Sushi == null)
|
if (Sushi == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user