lab2-hard.

This commit is contained in:
DeerElk 2024-06-21 16:19:37 +04:00
parent 7136015577
commit eabee21f9a
3 changed files with 5 additions and 6 deletions

View File

@ -5,7 +5,6 @@ using ConfectioneryFileImplement.Implements;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging; using NLog.Extensions.Logging;
using PastriesShopBusinessLogic.BusinessLogics;
namespace ConfectioneryView namespace ConfectioneryView
{ {
internal static class Program internal static class Program

View File

@ -5,7 +5,7 @@ using ConfectioneryContracts.StoragesContracts;
using ConfectioneryContracts.ViewModels; using ConfectioneryContracts.ViewModels;
using ConfectioneryDataModels.Models; using ConfectioneryDataModels.Models;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
namespace PastriesShopBusinessLogic.BusinessLogics namespace ConfectioneryBusinessLogic.BusinessLogics
{ {
public class ShopLogic : IShopLogic public class ShopLogic : IShopLogic
{ {

View File

@ -77,10 +77,10 @@ namespace ConfectioneryFileImplement.Implements
} }
private bool CheckAvailability(int PastryId, int count) private bool CheckAvailability(int PastryId, int count)
{ {
count -= _source.Shops.Select( count -= _source.Shops
x => x.ShopPastries.Select(y => .SelectMany(x => x.ShopPastries)
(y.Value.Item1.Id == PastryId ? .Where(y => y.Value.Item1.Id == PastryId)
y.Value.Item2 : 0)).Sum()).Sum(); .Sum(y => y.Value.Item2);
return count <= 0; return count <= 0;
} }
public bool SellPastries(IPastryModel model, int count) public bool SellPastries(IPastryModel model, int count)