Merge branch 'Lab5_Base' into Lab6_Base
This commit is contained in:
commit
63e641cd62
@ -66,7 +66,14 @@ namespace ConfectioneryListImplement
|
|||||||
|
|
||||||
public ClientViewModel? Insert(ClientBindingModel model)
|
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);
|
var res = Client.Create(model);
|
||||||
if (res != null)
|
if (res != null)
|
||||||
{
|
{
|
||||||
|
@ -89,6 +89,7 @@ namespace ConfectioneryDatabaseImplement.Models
|
|||||||
return new()
|
return new()
|
||||||
{
|
{
|
||||||
PastryName = context.Pastries.FirstOrDefault(x => x.Id == PastryId)?.PastryName ?? string.Empty,
|
PastryName = context.Pastries.FirstOrDefault(x => x.Id == PastryId)?.PastryName ?? string.Empty,
|
||||||
|
ClientId = ClientId,
|
||||||
ClientFIO = Client?.ClientFIO ?? string.Empty,
|
ClientFIO = Client?.ClientFIO ?? string.Empty,
|
||||||
ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty,
|
ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty,
|
||||||
PastryId = PastryId,
|
PastryId = PastryId,
|
||||||
|
Loading…
Reference in New Issue
Block a user