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); }
public Task <IList <Bill> > GetFilteredBillsAsync(BillFilterInfo billFilterInfo) { var filter = billDbFilterFactory.Create(billFilterInfo); return(billRepository.GetAllAsync(filter)); }