From 266e6aa1acc6b52d8301029b94dd851290164e38 Mon Sep 17 00:00:00 2001 From: MaD Date: Thu, 2 May 2024 17:25:14 +0400 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Implements/OrderStorage.cs | 20 +++++++++---------- .../Implements/OrderStorage.cs | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/GiftShop/GiftShopDatabaseImplement/Implements/OrderStorage.cs b/GiftShop/GiftShopDatabaseImplement/Implements/OrderStorage.cs index b602b71..978c67e 100644 --- a/GiftShop/GiftShopDatabaseImplement/Implements/OrderStorage.cs +++ b/GiftShop/GiftShopDatabaseImplement/Implements/OrderStorage.cs @@ -19,7 +19,7 @@ namespace GiftShopDatabaseImplement.Implements } context.Orders.Remove(element); context.SaveChanges(); - return AcessDressesStorage(element.GetViewModel, context); + return AcessGiftsStorage(element.GetViewModel, context); } @@ -30,7 +30,7 @@ namespace GiftShopDatabaseImplement.Implements return null; } using var context = new GiftShopDatabase(); - return AcessDressesStorage(context.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel, context); + return AcessGiftsStorage(context.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel, context); } public List GetFilteredList(OrderSearchModel model) @@ -40,13 +40,13 @@ namespace GiftShopDatabaseImplement.Implements return new(); } using var context = new GiftShopDatabase(); - return context.Orders.Where(x => x.Id == model.Id).Select(x => AcessDressesStorage(x.GetViewModel, context)).ToList(); + return context.Orders.Where(x => x.Id == model.Id).Select(x => AcessGiftsStorage(x.GetViewModel, context)).ToList(); } public List GetFullList() { using var context = new GiftShopDatabase(); - return context.Orders.Select(x => AcessDressesStorage(x.GetViewModel, context)).ToList(); + return context.Orders.Select(x => AcessGiftsStorage(x.GetViewModel, context)).ToList(); } @@ -60,7 +60,7 @@ namespace GiftShopDatabaseImplement.Implements using var context = new GiftShopDatabase(); context.Orders.Add(order); context.SaveChanges(); - return AcessDressesStorage(order.GetViewModel, context); + return AcessGiftsStorage(order.GetViewModel, context); } @@ -76,22 +76,22 @@ namespace GiftShopDatabaseImplement.Implements } order.Update(model); context.SaveChanges(); - return AcessDressesStorage(order.GetViewModel, context); + return AcessGiftsStorage(order.GetViewModel, context); } - public static OrderViewModel? AcessDressesStorage(OrderViewModel? model, GiftShopDatabase context) + public static OrderViewModel? AcessGiftsStorage(OrderViewModel? model, GiftShopDatabase context) { if (model == null) { return null; } - var dress = context.Gifts.FirstOrDefault(x => x.Id == model.GiftId); - if (dress == null) + var gifts = context.Gifts.FirstOrDefault(x => x.Id == model.GiftId); + if (gifts == null) { return null; } - model.GiftName = dress.GiftName; + model.GiftName = gifts.GiftName; return model; } diff --git a/GiftShop/GiftShopFileImplement/Implements/OrderStorage.cs b/GiftShop/GiftShopFileImplement/Implements/OrderStorage.cs index 784fad4..5297598 100644 --- a/GiftShop/GiftShopFileImplement/Implements/OrderStorage.cs +++ b/GiftShop/GiftShopFileImplement/Implements/OrderStorage.cs @@ -45,14 +45,14 @@ namespace GiftShopFileImplement.Implements public List GetFilteredList(OrderSearchModel model) { return source.Orders.Where(x => x.Id == model.Id) - .Select(x => AcessDressesStorage(x.GetViewModel)) + .Select(x => AcessGiftsStorage(x.GetViewModel)) .ToList(); } public List GetFullList() { - return source.Orders.Select(x => AcessDressesStorage(x.GetViewModel)).ToList(); + return source.Orders.Select(x => AcessGiftsStorage(x.GetViewModel)).ToList(); } @@ -88,7 +88,7 @@ namespace GiftShopFileImplement.Implements return order.GetViewModel; } - public OrderViewModel AcessDressesStorage(OrderViewModel model) + public OrderViewModel AcessGiftsStorage(OrderViewModel model) { var component = source.Gifts.FirstOrDefault(x => x.Id == model.GiftId); model.GiftName = component.GiftName;