ClientStorage GetFilteredList fix
This commit is contained in:
parent
e4a611748c
commit
bfe546dd2b
@ -19,15 +19,15 @@ namespace AutoWorkshopDatabaseImplement.Implements
|
||||
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel Model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Model.ClientFIO) && string.IsNullOrEmpty(Model.Email) && string.IsNullOrEmpty(Model.Password))
|
||||
if (string.IsNullOrEmpty(Model.ClientFIO) && string.IsNullOrEmpty(Model.Email))
|
||||
return new();
|
||||
|
||||
using var Context = new AutoWorkshopDatabase();
|
||||
|
||||
return Context.Clients
|
||||
.Where(x => (string.IsNullOrEmpty(Model.ClientFIO) || x.ClientFIO.Contains(Model.ClientFIO) &&
|
||||
(string.IsNullOrEmpty(Model.Email) || x.Email.Contains(Model.Email)) &&
|
||||
(string.IsNullOrEmpty(Model.Password) || x.Password.Contains(Model.Password))))
|
||||
.Where(x =>
|
||||
(!string.IsNullOrEmpty(Model.ClientFIO) && x.ClientFIO.Contains(Model.ClientFIO)) ||
|
||||
(!string.IsNullOrEmpty(Model.Email) && x.Email.Contains(Model.Email)))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -23,13 +23,13 @@ namespace AutoWorkshopFileImplement.Implements
|
||||
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel Model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Model.ClientFIO) && string.IsNullOrEmpty(Model.Email) && string.IsNullOrEmpty(Model.Password))
|
||||
if (string.IsNullOrEmpty(Model.ClientFIO) && string.IsNullOrEmpty(Model.Email))
|
||||
return new();
|
||||
|
||||
return _source.Clients
|
||||
.Where(x => (string.IsNullOrEmpty(Model.ClientFIO) || x.ClientFIO.Contains(Model.ClientFIO) &&
|
||||
(string.IsNullOrEmpty(Model.Email) || x.Email.Contains(Model.Email)) &&
|
||||
(string.IsNullOrEmpty(Model.Password) || x.Password.Contains(Model.Password))))
|
||||
.Where(x =>
|
||||
(!string.IsNullOrEmpty(Model.ClientFIO) && x.ClientFIO.Contains(Model.ClientFIO)) ||
|
||||
(!string.IsNullOrEmpty(Model.Email) && x.Email.Contains(Model.Email)))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -29,20 +29,15 @@ namespace AutoWorkshopListImplement.Implements
|
||||
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel Model)
|
||||
{
|
||||
var Result = new List<ClientViewModel>();
|
||||
|
||||
if (string.IsNullOrEmpty(Model.ClientFIO) && string.IsNullOrEmpty(Model.Email) && string.IsNullOrEmpty(Model.Password))
|
||||
return Result;
|
||||
if (string.IsNullOrEmpty(Model.ClientFIO) && string.IsNullOrEmpty(Model.Email))
|
||||
return new();
|
||||
|
||||
foreach (var Client in _source.Clients)
|
||||
{
|
||||
if (Client.ClientFIO.Contains(Model.ClientFIO))
|
||||
{
|
||||
Result.Add(Client.GetViewModel);
|
||||
}
|
||||
}
|
||||
|
||||
return Result;
|
||||
return _source.Clients
|
||||
.Where(x =>
|
||||
(!string.IsNullOrEmpty(Model.ClientFIO) && x.ClientFIO.Contains(Model.ClientFIO)) ||
|
||||
(!string.IsNullOrEmpty(Model.Email) && x.Email.Contains(Model.Email)))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public ClientViewModel? GetElement(ClientSearchModel Model)
|
||||
|
Loading…
Reference in New Issue
Block a user