Исправлено
This commit is contained in:
parent
b3d8a1a402
commit
ea4fca8e42
@ -43,14 +43,18 @@ namespace ShipyardDataBaseImplement.Implements
|
||||
|
||||
public ClientViewModel? GetElement(ClientSearchModel model)
|
||||
{
|
||||
if (string.IsNullOrEmpty(model.Email) && !model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new ShipyardDataBase();
|
||||
return context.Clients
|
||||
.FirstOrDefault(x => (!string.IsNullOrEmpty(model.Email) && x.Email == model.Email) ||
|
||||
(model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
if (model.Id.HasValue)
|
||||
{
|
||||
return context.Clients
|
||||
.FirstOrDefault(x => (x.Id == model.Id))?.GetViewModel;
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(model.Email) && !string.IsNullOrEmpty(model.Password))
|
||||
{
|
||||
return context.Clients
|
||||
.FirstOrDefault(x => (x.Email == model.Email && x.Password == model.Password))?.GetViewModel;
|
||||
}
|
||||
return new();
|
||||
}
|
||||
|
||||
public ClientViewModel? Insert(ClientBindingModel model)
|
||||
|
Loading…
Reference in New Issue
Block a user