ненавижу linq
This commit is contained in:
parent
bb9275361c
commit
2a4d859356
@ -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)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user