Правки в моделях поиска
This commit is contained in:
parent
9391517849
commit
6290c54f2c
@ -51,7 +51,7 @@ namespace FurnitureAssemFileImplement.Implements
|
|||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
return source.Clients
|
return source.Clients
|
||||||
.Where(x => x.Email.Contains(model.Email))
|
.Where(x => x.Email.Equals(model.Email) && x.Password.Equals(model.Password))
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -27,12 +27,12 @@ namespace FurnitureAssemFileImplement.Implements
|
|||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
return source.Orders
|
return source.Orders
|
||||||
.Where(x => x.Id.Equals(model.Id) || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
|
.Where(x => x.Id.Equals(model.Id) || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo || model.ClientId == x.ClientId)
|
||||||
.Select(x => GetOrderViewModel(x))
|
.Select(x => GetOrderViewModel(x))
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -5,5 +5,6 @@
|
|||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
|
|
||||||
public string? Email { get; set; }
|
public string? Email { get; set; }
|
||||||
|
public string? Password { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,6 @@ namespace FurnitureAssemblyContracts.SearchModels
|
|||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public DateTime? DateFrom { get; set; }
|
public DateTime? DateFrom { get; set; }
|
||||||
public DateTime? DateTo { get; set; }
|
public DateTime? DateTo { get; set; }
|
||||||
|
public int? ClientId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -42,13 +42,13 @@ namespace FurnitureAssemblyDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(model.Email))
|
if (string.IsNullOrEmpty(model.Email) || string.IsNullOrEmpty(model.Password))
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new FurnitureAssemblyDatabase();
|
using var context = new FurnitureAssemblyDatabase();
|
||||||
return context.Clients
|
return context.Clients
|
||||||
.Where(x => x.Email.Contains(model.Email))
|
.Where(x => x.Email.Equals(model.Email) && x.Password.Equals(model.Password))
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace FurnitureAssemblyDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue)
|
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
@ -37,7 +37,7 @@ namespace FurnitureAssemblyDatabaseImplement.Implements
|
|||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Furniture)
|
.Include(x => x.Furniture)
|
||||||
.Include(x => x.Client)
|
.Include(x => x.Client)
|
||||||
.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
|
.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo || model.ClientId == x.ClientId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -57,7 +57,7 @@ namespace FurnitureAssemblyListImplement.Implements
|
|||||||
}
|
}
|
||||||
foreach (var client in _source.Clients)
|
foreach (var client in _source.Clients)
|
||||||
{
|
{
|
||||||
if (client.Email.Contains(model.Email))
|
if (client.Email.Equals(model.Email) && client.Password.Equals(model.Password))
|
||||||
{
|
{
|
||||||
result.Add(client.GetViewModel);
|
result.Add(client.GetViewModel);
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ namespace FurnitureAssemblyListImplement.Implements
|
|||||||
|
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (order.Id.Equals(model.Id) || model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo)
|
if (order.Id.Equals(model.Id) || model.DateFrom <= order.DateCreate && order.DateCreate <= model.DateTo || order.ClientId.Equals(model.ClientId))
|
||||||
{
|
{
|
||||||
result.Add(GetOrderViewModel(order));
|
result.Add(GetOrderViewModel(order));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user