Turner I.A. Lab work 6 #7

Closed
TurnerIlya wants to merge 8 commits from LabWork_6 into LabWork_5
Showing only changes of commit b38577fc3a - Show all commits

View File

@ -44,7 +44,7 @@ namespace PlumbingRepairDatabaseImplement.Implements
.Select(x => x.GetViewModel)
.ToList();
}
else if (model.ClientId.HasValue)
else if (model.ClientId.HasValue)
{
return context.Orders
.Include(x => x.Work)
@ -64,9 +64,14 @@ namespace PlumbingRepairDatabaseImplement.Implements
.Select(x => x.GetViewModel)
.ToList();
}
return new();
}
return context.Orders
.Include(x => x.Work)
.Include(x => x.Client)
.Include(x => x.Implementer)
.Where(x => model.Status == x.Status)
.Select(x => x.GetViewModel)
.ToList();
}
public OrderViewModel? GetElement(OrderSearchModel model)
{
@ -81,9 +86,10 @@ namespace PlumbingRepairDatabaseImplement.Implements
.Include(x => x.Work)
.Include(x => x.Client)
.Include(x => x.Implementer)
.FirstOrDefault(x => (!model.ImplementerId.HasValue || x.ImplementerId == model.ImplementerId) &&
(!model.Status.HasValue || x.Status == model.Status) &&
(!model.Id.HasValue || x.Id == model.Id))?.GetViewModel;
.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;
}
public OrderViewModel? Insert(OrderBindingModel model)