PIbd-23. Elatomtsev L.K. Lab work 02 hard #16

Closed
DeerElk wants to merge 2 commits from lab2-hard into lab2
3 changed files with 5 additions and 6 deletions
Showing only changes of commit eabee21f9a - Show all commits

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)