Exemplo n.º 1
0
        // Gets all the loans and returns it
        public IActionResult Index()
        {
            var allLoans = _loanService.GetAll();

            var model = new LoanIndexModel();

            model.Loans = allLoans;

            return(View(model));
        }
Exemplo n.º 2
0
        // Returns the loan
        public IActionResult Return(int id)
        {
            if (ModelState.IsValid)
            {
                _loanService.ReturnLoan(id);

                var model = new LoanIndexModel();
                model.Loans = _loanService.GetAll();

                return(View("Index", model));
            }
            else
            {
                return(NotFound());
            }
        }