//GET: Books
        public async Task <IActionResult> Index()
        {
            var vm = new AuthorIndexVm();

            vm.Authors = authorService.GetAllAuthors();
            return(View(vm));
        }
示例#2
0
        // GET: Authors
        public async Task <IActionResult> Index(string ex)
        {
            var vm = new AuthorIndexVm();

            if (!string.IsNullOrEmpty(ex))
            {
                vm.Ex = ex;
            }
            vm.Authors = authorservice.GetAllAuthors();
            return(View(vm));
        }
        public async Task <IActionResult> Index(string search)
        {
            var vm = new AuthorIndexVm();

            if (search == null) //If search is empty the list will show all authors
            {
                vm.Authors = authorService.GetAllAuthors();
                return(View(vm));
            }
            else //Show search result
            {
                vm.Authors = authorService.SearchAuthors(search);
                return(View(vm));
            }
        }