示例#1
0
        public async Task <List <BillModel> > GetAllBills()
        {
            var bills = await _billRepository.GetAllAsync();

            var billsModels = new List <BillModel>();

            foreach (var bill in bills)
            {
                decimal adjustedValue = bill.OriginalValue;

                if (bill.PayDay.CompareTo(bill.DueDate) > 0)
                {
                    adjustedValue = await CalculateInterestAndPenalty(bill);
                }


                var model = new BillModel
                {
                    Name             = bill.Name,
                    NumberOfDaysLate = CalculateDaysofLate(bill),
                    OriginalValue    = bill.OriginalValue,
                    PayDay           = bill.PayDay,
                    AdjustedValue    = adjustedValue
                };

                billsModels.Add(model);
            }

            return(billsModels);
        }
示例#2
0
        public Task <IList <Bill> > GetFilteredBillsAsync(BillFilterInfo billFilterInfo)
        {
            var filter = billDbFilterFactory.Create(billFilterInfo);

            return(billRepository.GetAllAsync(filter));
        }