вот теперь работает
This commit is contained in:
parent
04daacfad4
commit
163e5f614b
@ -26,23 +26,18 @@ namespace PlumbingRepairDatabaseImplement.Implements
|
||||
|
||||
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ImplementerFIO) &&
|
||||
string.IsNullOrEmpty(model.Password) &&
|
||||
!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new PlumbingRepairDataBase();
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.Implementers
|
||||
.FirstOrDefault(x => (x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(model.ImplementerFIO) && !string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return context.Implementers
|
||||
.FirstOrDefault(x => (x.ImplementerFIO == model.ImplementerFIO && x.Password == model.Password))?.GetViewModel;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(model.ImplementerFIO))
|
||||
{
|
||||
return context.Implementers
|
||||
.FirstOrDefault(x => (x.ImplementerFIO == model.ImplementerFIO))?.GetViewModel;
|
||||
}
|
||||
return new();
|
||||
.FirstOrDefault(x => (string.IsNullOrEmpty(model.ImplementerFIO) || x.ImplementerFIO == model.ImplementerFIO) &&
|
||||
(string.IsNullOrEmpty(model.Password) || x.Password == model.Password) &&
|
||||
(!model.Id.HasValue || x.Id == model.Id))
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
||||
|
@ -86,10 +86,9 @@ namespace PlumbingRepairDatabaseImplement.Implements
|
||||
.Include(x => x.Work)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.FirstOrDefault(x => (model.Status == null || model.Status != null && model.Status == x.Status) &&
|
||||
model.ImplementerId.HasValue && x.ImplementerId == model.ImplementerId ||
|
||||
model.Id.HasValue && x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
.FirstOrDefault(x => (!model.ImplementerId.HasValue || x.ImplementerId == model.ImplementerId) &&
|
||||
(!model.Status.HasValue || x.Status == model.Status) &&
|
||||
(!model.Id.HasValue || x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
|
Loading…
Reference in New Issue
Block a user