Beispiel #1
0
        public ActionResult EditPaymentBill(int paymentBillId)
        {
            var viewModel = new PaymentBillViewModel();
            var result    = paymentBillService.GetSinglePaymentBillById(paymentBillId);

            viewModel = ViewModelMapper.Mapper.Map <PaymentBillViewModel>(result);
            return(View(viewModel));
        }
Beispiel #2
0
        public ActionResult AddPaymentBill(int rentalId)
        {
            var viewModel = new PaymentBillViewModel()
            {
                id_wynajem = rentalId,
                id_faktury = -1       //This is a brand new payment so there's no id.
            };

            return(View("EditPaymentBill", viewModel));
        }
Beispiel #3
0
        public void ConfirmPaymentBillEdit(int rentalId, int paymentBillId, float paymentBillValue, DateTime paymentBillDate, int paymentBillNumber)
        {
            var viewModel = new PaymentBillViewModel()
            {
                id_wynajem     = rentalId,
                cena           = paymentBillValue,
                data_platnosci = paymentBillDate,
                id_faktury     = paymentBillId,
                numer_faktury  = paymentBillNumber
            };


            paymentBillService.AddOrEditPaymentBill(ViewModelMapper.Mapper.Map <PaymentBillModel>(viewModel));
        }
Beispiel #4
0
        public IActionResult CloseBill([FromBody] PaymentBillViewModel paymentBill)
        {
            var bill = _service.GetById(paymentBill.BillId);

            if (bill == null)
            {
                return(NotFound(false));
            }

            if (!Enum.GetValues(typeof(PaymentMethod)).Cast <PaymentMethod>().Any(m => m.Equals(paymentBill.PaymentMethod)))
            {
                return(NotFound(false));
            }

            return(Ok(_service.CloseBill(bill, paymentBill.PaymentMethod)));
        }