示例#1
0
        public override SpendSummary GetTotalSpend(int supplierId)
        {
            SpendSummary result = new SpendSummary();

            result.Name  = supplierService.GetById(supplierId).Name;
            result.Years = circuitBreaker.GetSpendDetail(supplierId);

            return(result);
        }
示例#2
0
        public override SpendSummary GetTotalSpend(int supplierId)
        {
            Supplier supplier = supplierService.GetById(supplierId);

            SpendSummary result = new SpendSummary();

            result.Name  = supplier.Name;
            result.Years = InvoiceRepository.Get().Where(i => i.SupplierId == supplier.Id)
                           .GroupBy(
                i => i.InvoiceDate.Year,
                i => i.Amount,
                (key, g) => new SpendDetail()
            {
                Year = key, TotalSpend = g.Sum()
            }
                ).ToList();

            return(result);
        }