//filter je troznamenkasti broj u obliku stringa gdje je 1.znamenka -> yearId, 2.znamenka -> monthId, 3.znamenka -> typeId, id = 0 znaci iskljucnost filtera public async Task <IActionResult> getPaymentsWithFilters(string filters, int yearId, int monthId, int typeId) { ICollection <Payment> payments = await _service.getPaymentsWithFilters(filters, yearId, monthId, typeId); PaymentWithRecap payWr = await _service.getRecap(payments); return(Ok(payWr)); }
public async Task <IActionResult> getPaymentsForBusPass(int busPassId) { ICollection <Payment> payments = await _service.getPaymentsForBusPass(busPassId); PaymentWithRecap payWr = await _service.getRecap(payments); return(Ok(payWr)); }
public Task <PaymentWithRecap> getRecap(ICollection <Payment> payments) { double totalAmount = 0; int numberOfPayments = 0; foreach (Payment payment in payments) { totalAmount += payment.price; numberOfPayments++; } PaymentWithRecap paymentsWithRecap = new PaymentWithRecap(payments, totalAmount, numberOfPayments); return(Task.FromResult(paymentsWithRecap)); }