This commit is contained in:
Данияр Аглиуллов 2023-03-13 23:01:00 +04:00
parent a157403c04
commit 530526760f
2 changed files with 10 additions and 2 deletions

View File

@ -66,7 +66,14 @@ namespace ConfectioneryListImplement
public ClientViewModel? Insert(ClientBindingModel model)
{
model.Id = _source.Clients.Count > 0 ? _source.Clients.Max(x => x.Id) + 1 : 1;
model.Id = 1;
foreach (var component in _source.Components)
{
if (model.Id <= component.Id)
{
model.Id = component.Id + 1;
}
}
var res = Client.Create(model);
if (res != null)
{

View File

@ -84,6 +84,7 @@ namespace ConfectioneryDatabaseImplement.Models
return new()
{
PastryName = context.Pastries.FirstOrDefault(x => x.Id == PastryId)?.PastryName ?? string.Empty,
ClientId = ClientId,
ClientFIO = Client?.ClientFIO ?? string.Empty,
PastryId = PastryId,
Count = Count,