Добавил вохможность поиска заказа по статусу и исполнителю
This commit is contained in:
parent
0ef5453070
commit
86fa2bf375
@ -1,4 +1,6 @@
|
||||
namespace SecuritySystemContracts.SearchModels
|
||||
using SecuritySystemDataModels.Enums;
|
||||
|
||||
namespace SecuritySystemContracts.SearchModels
|
||||
{
|
||||
public class OrderSearchModel
|
||||
{
|
||||
@ -7,5 +9,6 @@
|
||||
public DateTime? DateTo { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public int? ImplementerId { get; set; }
|
||||
public OrderStatus? Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -25,12 +25,21 @@ namespace SecuritySystemDatabaseImplement.Implements
|
||||
var orders = context.Orders
|
||||
.Include(x => x.Secure)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.Id == model.Id.Value).ToList();
|
||||
}
|
||||
if (model.Status.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.Status == model.Status.Value).ToList();
|
||||
}
|
||||
if (model.ImplementerId.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.ImplementerId == model.ImplementerId.Value).ToList();
|
||||
}
|
||||
if (model.DateFrom.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.DateCreate >= model.DateFrom.Value).ToList();
|
||||
|
@ -33,6 +33,14 @@ namespace SecuritySystemFileImplement.Implements
|
||||
{
|
||||
orders = orders.Where(x => x.Id == model.Id.Value).ToList();
|
||||
}
|
||||
if (model.Status.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.Status == model.Status.Value).ToList();
|
||||
}
|
||||
if (model.ImplementerId.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.ImplementerId == model.ImplementerId.Value).ToList();
|
||||
}
|
||||
if (model.DateFrom.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.DateCreate >= model.DateFrom.Value).ToList();
|
||||
|
@ -31,6 +31,14 @@ namespace SecuritySystemListImplement.Implements
|
||||
{
|
||||
orders = orders.Where(x => x.Id == model.Id.Value).ToList();
|
||||
}
|
||||
if (model.Status.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.Status == model.Status.Value).ToList();
|
||||
}
|
||||
if (model.ImplementerId.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.ImplementerId == model.ImplementerId.Value).ToList();
|
||||
}
|
||||
if (model.DateFrom.HasValue)
|
||||
{
|
||||
orders = orders.Where(x => x.DateCreate >= model.DateFrom.Value).ToList();
|
||||
|
Loading…
Reference in New Issue
Block a user