6 лаба беда бедовая не работает

This commit is contained in:
Полина Чубыкина 2024-05-05 12:47:03 +04:00
parent 2878ea7bbb
commit d1973efdce
2 changed files with 7 additions and 3 deletions

View File

@ -78,7 +78,7 @@ namespace ConfectioneryDatabaseImplement.Implements
public OrderViewModel? GetElement(OrderSearchModel model)
{
if (!model.Id.HasValue)
if (!model.Id.HasValue && !model.ImplementerId.HasValue)
{
return null;
}
@ -125,7 +125,7 @@ namespace ConfectioneryDatabaseImplement.Implements
return context.Orders
.Include(x => x.Pastry)
.Include(x => x.Client)
.Include(x => x.Implementer)
.Include(x => x.Implementer)
.FirstOrDefault(x => x.Id == model.Id)
?.GetViewModel;
}

View File

@ -37,6 +37,7 @@ namespace ConfectioneryDatabaseImplement.Models
Id = model.Id,
PastryId = model.PastryId,
ClientId = model.ClientId,
ImplementerId = model.ImplementerId,
Count = model.Count,
Sum = model.Sum,
Status = model.Status,
@ -53,6 +54,7 @@ namespace ConfectioneryDatabaseImplement.Models
}
Status = model.Status;
DateImplement = model.DateImplement;
ImplementerId = model.ImplementerId;
}
public OrderViewModel GetViewModel => new()
@ -60,13 +62,15 @@ namespace ConfectioneryDatabaseImplement.Models
Id = Id,
PastryId = PastryId,
ClientId = ClientId,
ImplementerId = ImplementerId,
Count = Count,
Sum = Sum,
Status = Status,
DateCreate = DateCreate,
DateImplement = DateImplement,
PastryName = Pastry.PastryName,
ClientFIO = Client.ClientFIO
ClientFIO = Client.ClientFIO,
ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty
};
}
}