PIbd-23. Elatomtsev L.K. Lab work 02 hard #16
@ -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
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user