Search client by login

This commit is contained in:
ShabOl 2024-04-20 19:08:51 +04:00
parent 7ff81c6bbd
commit cfd78033b2

View File

@ -19,7 +19,7 @@ namespace AutoWorkshopDatabaseImplement.Implements
public List<ClientViewModel> GetFilteredList(ClientSearchModel Model)
{
if (string.IsNullOrEmpty(Model.ClientFIO) && string.IsNullOrEmpty(Model.Email)) // TODO: check selecting by email
if (string.IsNullOrEmpty(Model.Email) && string.IsNullOrEmpty(Model.ClientFIO))
return new();
using var Context = new AutoWorkshopDatabase();
@ -44,7 +44,7 @@ namespace AutoWorkshopDatabaseImplement.Implements
return Context.Clients
.FirstOrDefault(x => (string.IsNullOrEmpty(Model.ClientFIO) || x.ClientFIO == Model.ClientFIO) &&
(!Model.Id.HasValue || x.Id == Model.Id) && (string.IsNullOrEmpty(Model.Email) || x.Email == Model.Email) &&
(string.IsNullOrEmpty(Model.Email) || x.Email == Model.Email) && (!Model.Id.HasValue || x.Id == Model.Id) &&
(string.IsNullOrEmpty(Model.Password) || x.Password == Model.Password))?
.GetViewModel;
}