ненавижу linq

This commit is contained in:
Данияр Аглиуллов 2023-03-13 23:26:13 +04:00
parent bb9275361c
commit 2a4d859356

View File

@ -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)
{