public IActionResult Rented(string userId) { if (string.IsNullOrEmpty(userId)) { return(RedirectToAction("Index")); } var user = _usersRepository.FindByUserId(userId); IEnumerable <BookItem> rentedBooks = _rentalService.FindRentedBooks(userId); var viewModel = new RentedViewModel { User = user, RentedBooks = rentedBooks, }; return(View(viewModel)); }