From 0732cc0ede52309c677d77f2077239eb9b285f00 Mon Sep 17 00:00:00 2001 From: VictoriaPresnyakova Date: Mon, 20 Feb 2023 15:09:55 +0400 Subject: [PATCH] component storage full --- JewelryStoreFileImplement/Implements/ComponentStorage .cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/JewelryStoreFileImplement/Implements/ComponentStorage .cs b/JewelryStoreFileImplement/Implements/ComponentStorage .cs index a882b1b..11ec35c 100644 --- a/JewelryStoreFileImplement/Implements/ComponentStorage .cs +++ b/JewelryStoreFileImplement/Implements/ComponentStorage .cs @@ -48,8 +48,7 @@ namespace JewelryStoreFileImplement.Implements } public ComponentViewModel? Insert(ComponentBindingModel model) { - model.Id = _source.Components.Count > 0 ? _source.Components.Max(x => -x.Id) + 1 : 1; + model.Id = _source.Components.Count > 0 ? _source.Components.Max(x =>x.Id) + 1 : 1; var newComponent = Component.Create(model); if (newComponent == null) { @@ -62,8 +61,7 @@ x.Id) + 1 : 1; public ComponentViewModel? Update(ComponentBindingModel model) { - var component = _source.Components.FirstOrDefault(x => x.Id == -model.Id); + var component = _source.Components.FirstOrDefault(x => x.Id ==model.Id); if (component == null) { return null;