lab2-hard.
This commit is contained in:
parent
7136015577
commit
eabee21f9a
@ -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
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user