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)
|
public ClientViewModel? Insert(ClientBindingModel model)
|
||||||
{
|
{
|
||||||
model.Id = _source.Clients.Count > 0 ? _source.Clients.Max(x => x.Id) + 1 : 1;
|
model.Id = 1;
|
||||||
var res = Client.Create(model);
|
foreach (var client in _source.Clients)
|
||||||
|
{
|
||||||
|
if (model.Id <= client.Id)
|
||||||
|
{
|
||||||
|
model.Id = client.Id + 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var res = Client.Create(model);
|
||||||
if (res != null)
|
if (res != null)
|
||||||
{
|
{
|
||||||
_source.Clients.Add(res);
|
_source.Clients.Add(res);
|
||||||
|
@ -82,7 +82,14 @@ namespace ConfectioneryListImplement
|
|||||||
|
|
||||||
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
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);
|
var res = Implementer.Create(model);
|
||||||
if (res != null)
|
if (res != null)
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,9 @@ 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,
|
||||||
|
ImplementerId = ImplementerId,
|
||||||
ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty,
|
ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty,
|
||||||
PastryId = PastryId,
|
PastryId = PastryId,
|
||||||
Count = Count,
|
Count = Count,
|
||||||
|
Loading…
Reference in New Issue
Block a user