using CanteenContracts.BindingModels; using CanteenContracts.BusinessLogicsContracts; using CanteenContracts.StoragesContracts; using CanteenContracts.View; using CanteenContracts.ViewModels; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CanteenBusinessLogic.BusinessLogics { public class GraphicLogic : IGraphicLogic { private readonly IProductStorage _educationStorage; public GraphicLogic(IProductStorage educationStorage) { _educationStorage = educationStorage; } public GraphicViewModel GetGraphicByPrice() { return new GraphicViewModel { Title = "Диаграмма выполненных заказов каждым поваром", ColumnName = "Повара", ValueName = "Количество заказов", Data = GetEducation().Select(rec => new Tuple(rec.ProductName, Convert.ToInt32(rec.Price))).ToList() }; } public GraphicViewModel GetGraphicByCount() { return new GraphicViewModel { Title = "Диаграмма продаваемости блюд", ColumnName = "Блюда", ValueName = "Количество блюд", Data = GetEducation().Select(rec => new Tuple(rec.ProductName, rec.Price)).ToList() }; } private List GetEducation() { return _educationStorage.GetFullList(); } } }