Пример #1
0
        public ISellReportResponse GetSellReport(string fromdate, string todate)
        {
            var report = new SellReportResponse();

            IEnumerable <ISellHistory> historyList = _dataAccess.GetSellHistory(fromdate, todate);

            return(this.CreateSellReport(historyList));
        }
Пример #2
0
        private ISellReportResponse CreateSellReport(IEnumerable <ISellHistory> historyList)
        {
            var response     = new SellReportResponse();
            var soldProducts = new List <SoldProduct>();

            foreach (var historyEntry in historyList)
            {
                var soldProduct = new SoldProduct();
                soldProduct.Quantity     = historyEntry.Quantity;
                soldProduct.Id           = historyEntry.ProductId;
                soldProduct.Name         = _dataAccess.GetProductById(historyEntry.ProductId).Name;
                soldProduct.SellingPrice = historyEntry.SellingPrice;

                soldProducts.Add(soldProduct);
            }

            response.Products = soldProducts;
            return(response);
        }