sad
This commit is contained in:
parent
96bb26dc1b
commit
15ccb0dca1
@ -15,13 +15,14 @@ namespace AircraftPlantDatabaseImplement.Implements
|
||||
return context.Orders
|
||||
.Include(x => x.Plane)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue && !model.ClientId.HasValue && (!model.DateFrom.HasValue || !model.DateTo.HasValue))
|
||||
if (!model.Id.HasValue && !model.ClientId.HasValue && (!model.DateFrom.HasValue || !model.DateTo.HasValue) && model.Status == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
@ -31,6 +32,7 @@ namespace AircraftPlantDatabaseImplement.Implements
|
||||
return context.Orders
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Plane)
|
||||
.Include(x => x.Implementer)
|
||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
@ -41,11 +43,21 @@ namespace AircraftPlantDatabaseImplement.Implements
|
||||
return context.Orders
|
||||
.Include(x => x.Plane)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
if (model.Status.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Plane)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Where(x => x.Status == model.Status)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
return context.Orders
|
||||
.Include(x => x.Plane)
|
||||
.Include(x => x.Client)
|
||||
@ -61,11 +73,36 @@ namespace AircraftPlantDatabaseImplement.Implements
|
||||
return null;
|
||||
}
|
||||
using var context = new AircraftPlantDatabase();
|
||||
return context.Orders
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Plane)
|
||||
.Include(x => x.Client)
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?
|
||||
.GetViewModel;
|
||||
.Include(x => x.Implementer)
|
||||
.FirstOrDefault(x => x.Id == model.Id)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
if (model.ImplementerId.HasValue && model.Status.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Plane)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.FirstOrDefault(x => x.ImplementerId == model.ImplementerId && x.Status == model.Status)
|
||||
?.GetViewModel;
|
||||
}
|
||||
|
||||
if (model.ImplementerId.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Plane)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.FirstOrDefault(x => x.ImplementerId == model.ImplementerId)
|
||||
?.GetViewModel;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
|
Loading…
Reference in New Issue
Block a user