public ActionResult Index(PaginacaoViewModel <TagsViewModel> view) { try { var result = _tagsAppService.GetAll(new Paginacao(view.Pagina, view.TotalPorPagina)); ViewBag.PagedList = new StaticPagedList <TagsViewModel> ( result.Resultado, result.Pagina, result.TotalPorPagina, result.Total ); ViewBag.TotalItens = result.Total; return(View("Index", result)); } catch (Exception ex) { ViewBag.TotalItens = 0; ViewBag.Error = $"Erro ao pesquisar vaga. Erro: {ex.Message}"; return(View("Index")); } }
public ActionResult Index(VagasFiltroViewModel <VagaEstagioViewModel> view) { try { var tagsDisponiveis = new List <DropDownDto <int> > { new DropDownDto <int> { Descricao = "Tag", Id = 0 } }; _tagsAppService.GetAll().ToList().ForEach(x => tagsDisponiveis.Add(new DropDownDto <int> { Descricao = x.Nome, Id = x.Id })); ViewBag.Tags = tagsDisponiveis; var pesquisa = view.PesquisaTitulo; var tags = view.Tags; var result = _vagaEstagioAppService.GetAllByTituloTags ( pesquisa, tags, new Paginacao(view.Pagina, Constants.NumeroVagasPorPagina) ); ViewBag.PagedList = new StaticPagedList <VagaEstagioViewModel> ( result.Resultado, result.Pagina, result.TotalPorPagina, result.Total ); ViewBag.TotalItens = result.Total; return(View("Index", result)); } catch (Exception ex) { ViewBag.TotalItens = 0; ViewBag.Error = $"Erro ao pesquisar vaga. Erro: {ex.Message}"; return(View("Index")); } }