// Gets all the loans and returns it public IActionResult Index() { var allLoans = _loanService.GetAll(); var model = new LoanIndexModel(); model.Loans = allLoans; return(View(model)); }
// 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()); } }