шаманю
This commit is contained in:
parent
ab6b3d0d15
commit
c646b88323
@ -190,6 +190,10 @@ namespace AircraftPlantBusinessLogic.BusinessLogics
|
||||
|
||||
model.Status = newStatus;
|
||||
|
||||
if (element.ImplementerId.HasValue)
|
||||
{
|
||||
model.ImplementerId = element.ImplementerId;
|
||||
}
|
||||
if (model.Status == OrderStatus.Готов)
|
||||
{
|
||||
model.DateImplement = DateTime.Now;
|
||||
|
@ -15,14 +15,13 @@ 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) && model.Status == null)
|
||||
if (!model.Id.HasValue && !model.ClientId.HasValue && (!model.DateFrom.HasValue || !model.DateTo.HasValue))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
@ -32,29 +31,16 @@ 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();
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
if (model.ClientId.HasValue)
|
||||
{
|
||||
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();
|
||||
@ -75,37 +61,11 @@ namespace AircraftPlantDatabaseImplement.Implements
|
||||
return null;
|
||||
}
|
||||
using var context = new AircraftPlantDatabase();
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Plane)
|
||||
.Include(x => x.Client)
|
||||
.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;
|
||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?
|
||||
.GetViewModel;
|
||||
}
|
||||
|
||||
public OrderViewModel? Insert(OrderBindingModel model)
|
||||
|
Loading…
Reference in New Issue
Block a user