фиксы
This commit is contained in:
parent
f73ace27d3
commit
f9e191a08f
@ -24,25 +24,26 @@ namespace CarCenterDatabaseImplement.Implements
|
||||
}
|
||||
public List<StorekeeperViewModel> GetFilteredList(StorekeeperSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
if (model.Id.HasValue)
|
||||
using var context = new CarCenterDatabase();
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
var res = GetElement(model);
|
||||
|
||||
return res != null ? new() { res } : new();
|
||||
}
|
||||
return new();
|
||||
return context.Storekeepers.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new();
|
||||
}
|
||||
}
|
||||
|
||||
public StorekeeperViewModel? GetElement(StorekeeperSearchModel model)
|
||||
{
|
||||
using var context = new CarCenterDatabase();
|
||||
|
||||
if (model.Id.HasValue)
|
||||
if (!model.Id.HasValue) { return null; }
|
||||
if (model.Id.HasValue)
|
||||
return context.Storekeepers
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
|
@ -24,19 +24,20 @@ namespace CarCenterDatabaseImplement.Implements
|
||||
}
|
||||
public List<WorkerViewModel> GetFilteredList(WorkerSearchModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
var res = GetElement(model);
|
||||
|
||||
return res != null ? new() { res } : new();
|
||||
}
|
||||
return new();
|
||||
}
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new CarCenterDatabase();
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.Workers.Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new();
|
||||
}
|
||||
}
|
||||
|
||||
public WorkerViewModel? GetElement(WorkerSearchModel model)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user