public IActionResult Index(string SearchAuthor = null) { var model = new AuthorsIndexViewModel(); model.Authors = authorService.GetAuthors(SearchAuthor); return(View(model)); }
public ActionResult Authors() { var viewModel = new AuthorsIndexViewModel(); try { var authors = _repository.GetAuthors(); var books = _repository.GetBooks(); viewModel.PrepareData(books, authors); } catch (Exception e) { var errorModel = new ErrorModel { Message = "Greška prilikom dohvaćanja liste autora" }; return(View("Error", errorModel)); } return(View(viewModel)); }