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.Logging;
using NLog.Extensions.Logging;
using PastriesShopBusinessLogic.BusinessLogics;
namespace ConfectioneryView
{
internal static class Program

View File

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

View File

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