filter by email
This commit is contained in:
parent
0961c271c8
commit
562ad85327
@ -40,12 +40,12 @@ namespace JewelryStoreDatabaseImplement.Implements
|
||||
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ClientFIO))
|
||||
if (string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new JewelryStoreDataBase();
|
||||
return context.Clients.Where(x => x.ClientFIO.Contains(model.ClientFIO)).Select(x => x.GetViewModel).ToList();
|
||||
return context.Clients.Where(x => x.Email.Contains(model.Email)).Select(x => x.GetViewModel).ToList();
|
||||
}
|
||||
|
||||
public List<ClientViewModel> GetFullList()
|
||||
|
@ -24,12 +24,12 @@ namespace JewelryStoreFileImplement.Implements
|
||||
}
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ClientFIO))
|
||||
if (string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
return source.Clients
|
||||
.Where(x => x.ClientFIO.Contains(model.ClientFIO))
|
||||
.Where(x => x.Email.Contains(model.Email))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
@ -30,13 +30,13 @@ namespace JewelryStoreListImplement.Implements
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||
{
|
||||
var result = new List<ClientViewModel>();
|
||||
if (string.IsNullOrEmpty(model.ClientFIO))
|
||||
if (string.IsNullOrEmpty(model.Email))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
foreach (var client in _source.Clients)
|
||||
{
|
||||
if (client.ClientFIO.Contains(model.ClientFIO))
|
||||
if (client.Email.Contains(model.Email))
|
||||
{
|
||||
result.Add(client.GetViewModel);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user