コード例 #1
0
        //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));
        }
コード例 #2
0
        public async Task <IActionResult> getPaymentsForBusPass(int busPassId)
        {
            ICollection <Payment> payments = await _service.getPaymentsForBusPass(busPassId);

            PaymentWithRecap payWr = await _service.getRecap(payments);

            return(Ok(payWr));
        }
コード例 #3
0
        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));
        }