示例#1
0
        public async Task <IEnumerable <Response> > DoAsync()
        {
            await _stockManager.RetrieveExpiredStocksOnHoldAsync();

            return(_productManager
                   .GetProducts(x => true,
                                x => new Response
            {
                Id = x.Id,
                Name = x.Name,
                Description = x.Description,
                ValueInRubles = x.Value,
                StockCount = x.Stock.Sum(y => y.Qty)
            }));
        }
示例#2
0
        public async Task <Response> DoAsync(int id)
        {
            await _stockManager.RetrieveExpiredStocksOnHoldAsync();

            return(_productManager.GetProductById(id, x => new Response
            {
                Id = x.Id,
                Name = x.Name,
                Description = x.Description,
                ValueInRubles = x.Value,
                Stock = x.Stock.Select(y => new StockViewModel
                {
                    Id = y.Id,
                    Description = y.Description,
                    Qty = y.Qty
                }).ToList()
            }));
        }