CourseWorkElectronicsShop/ElectronicsShop/ElectronicsShopBusinessLogic/BusinessLogic/ReportLogic.cs
Илья Федотов b007290469 Report fix
2024-04-30 22:48:51 +04:00

39 lines
1.2 KiB
C#

using ElectronicsShopContracts.BindingModels;
using ElectronicsShopContracts.BusinessLogicContracts;
using ElectronicsShopContracts.SearchModels;
using ElectronicsShopContracts.StorageContracts;
using ElectronicsShopContracts.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ElectronicsShopBusinessLogic.BusinessLogic
{
public class ReportLogic : IReportLogic
{
private readonly IOrderStorage _orderStorage;
private readonly IProductStorage _productStorag;
public ReportLogic(IOrderStorage orderStorage, IProductStorage productStorag) {
_orderStorage = orderStorage;
_productStorag = productStorag;
}
// Получение списка заказов за определенный период
public List<ReportOrdersViewModel> GetOrders(ReportBindingModel model) {
return _orderStorage.GetFilteredList(new OrderSearchModel {
DateFrom = model.DateFrom,
DateTo = model.DateTo,
}).Select(x => new ReportOrdersViewModel {
ID = x.ID,
DateCreate = x.DateCreate,
Sum = x.Sum,
PaymeantOption = x.PaymeantOption.ToString(),
OrderStatus = x.Status.ToString(),
}).ToList();
}
}
}