Merge branch 'Lab6_Base' into Lab7_Base
This commit is contained in:
commit
ac219be3bf
@ -66,8 +66,15 @@ namespace ConfectioneryListImplement
|
||||
|
||||
public ClientViewModel? Insert(ClientBindingModel model)
|
||||
{
|
||||
model.Id = _source.Clients.Count > 0 ? _source.Clients.Max(x => x.Id) + 1 : 1;
|
||||
var res = Client.Create(model);
|
||||
model.Id = 1;
|
||||
foreach (var client in _source.Clients)
|
||||
{
|
||||
if (model.Id <= client.Id)
|
||||
{
|
||||
model.Id = client.Id + 1;
|
||||
}
|
||||
}
|
||||
var res = Client.Create(model);
|
||||
if (res != null)
|
||||
{
|
||||
_source.Clients.Add(res);
|
||||
|
@ -82,7 +82,14 @@ namespace ConfectioneryListImplement
|
||||
|
||||
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
||||
{
|
||||
model.Id = _source.Implementers.Count > 0 ? _source.Implementers.Max(x => x.Id) + 1 : 1;
|
||||
model.Id = 1;
|
||||
foreach (var implementer in _source.Implementers)
|
||||
{
|
||||
if (model.Id <= implementer.Id)
|
||||
{
|
||||
model.Id = implementer.Id + 1;
|
||||
}
|
||||
}
|
||||
var res = Implementer.Create(model);
|
||||
if (res != null)
|
||||
{
|
||||
|
@ -89,7 +89,9 @@ namespace ConfectioneryDatabaseImplement.Models
|
||||
return new()
|
||||
{
|
||||
PastryName = context.Pastries.FirstOrDefault(x => x.Id == PastryId)?.PastryName ?? string.Empty,
|
||||
ClientId = ClientId,
|
||||
ClientFIO = Client?.ClientFIO ?? string.Empty,
|
||||
ImplementerId = ImplementerId,
|
||||
ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty,
|
||||
PastryId = PastryId,
|
||||
Count = Count,
|
||||
|
Loading…
Reference in New Issue
Block a user