Вернул пасворды
This commit is contained in:
parent
e8e34b73ea
commit
e90206d910
@ -11,5 +11,6 @@ namespace ComputersShopContracts.SearchModels
|
||||
public int? Id { get; set; }
|
||||
public string? ClientFIO { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Password { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -22,14 +22,15 @@ namespace ComputersShopDatabaseImplement.Implements
|
||||
}
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email))
|
||||
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email) && string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new ComputersShopDatabase();
|
||||
return context.Clients
|
||||
.Where(x => (string.IsNullOrEmpty(model.ClientFIO) || x.ClientFIO.Contains(model.ClientFIO) &&
|
||||
(string.IsNullOrEmpty(model.Email) || x.ClientFIO.Contains(model.Email))))
|
||||
(string.IsNullOrEmpty(model.Email) || x.ClientFIO.Contains(model.Email)) &&
|
||||
(string.IsNullOrEmpty(model.Password) || x.ClientFIO.Contains(model.Password))))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -43,7 +44,8 @@ namespace ComputersShopDatabaseImplement.Implements
|
||||
using var context = new ComputersShopDatabase();
|
||||
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))
|
||||
(!model.Id.HasValue || x.Id == model.Id) && (string.IsNullOrEmpty(model.Email) || x.Email == model.Email) &&
|
||||
(string.IsNullOrEmpty(model.Password) || x.Password == model.Password))
|
||||
?.GetViewModel;
|
||||
}
|
||||
public ClientViewModel? Insert(ClientBindingModel model)
|
||||
|
@ -27,13 +27,14 @@ namespace ComputersShopFileImplement.Implements
|
||||
public List<ClientViewModel> GetFilteredList(ClientSearchModel
|
||||
model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email))
|
||||
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email) && string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return new();
|
||||
}
|
||||
return source.Clients
|
||||
.Where(x => (string.IsNullOrEmpty(model.ClientFIO) || x.ClientFIO.Contains(model.ClientFIO) &&
|
||||
(string.IsNullOrEmpty(model.Email) || x.ClientFIO.Contains(model.Email))))
|
||||
(string.IsNullOrEmpty(model.Email) || x.ClientFIO.Contains(model.Email)) &&
|
||||
(string.IsNullOrEmpty(model.Password) || x.ClientFIO.Contains(model.Password))))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
@ -41,7 +42,8 @@ namespace ComputersShopFileImplement.Implements
|
||||
{
|
||||
return source.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))
|
||||
(!model.Id.HasValue || x.Id == model.Id) && (string.IsNullOrEmpty(model.Email) || x.Email == model.Email) &&
|
||||
(string.IsNullOrEmpty(model.Password) || x.Password == model.Password))
|
||||
?.GetViewModel;
|
||||
}
|
||||
public ClientViewModel? Insert(ClientBindingModel model)
|
||||
|
@ -31,7 +31,7 @@ namespace ComputersShopListImplement.Implements
|
||||
model)
|
||||
{
|
||||
var result = new List<ClientViewModel>();
|
||||
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email))
|
||||
if (string.IsNullOrEmpty(model.ClientFIO) && string.IsNullOrEmpty(model.Email) && string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
@ -49,7 +49,8 @@ namespace ComputersShopListImplement.Implements
|
||||
foreach (var client in _source.Clients)
|
||||
{
|
||||
if ((string.IsNullOrEmpty(model.ClientFIO) || client.ClientFIO == model.ClientFIO) &&
|
||||
(!model.Id.HasValue || client.Id == model.Id) && (string.IsNullOrEmpty(model.Email) || client.Email == model.Email))
|
||||
(!model.Id.HasValue || client.Id == model.Id) && (string.IsNullOrEmpty(model.Email) || client.Email == model.Email) &&
|
||||
(string.IsNullOrEmpty(model.Password) || client.Password == model.Password))
|
||||
{
|
||||
return client.GetViewModel;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user