Exemplo n.º 1
0
        public ActionResult Lista(LiberacaoContratoListaViewModel model)
        {
            if (ModelState.IsValid)
            {
                Session["Filtro"] = model;
                int totalRegistros;

                if (string.IsNullOrEmpty(model.Filtro.PaginationParameters.OrderBy))
                {
                    model.Filtro.PaginationParameters.OrderBy = "id";
                }

                var result = contratoAppService.ListarPeloFiltro(model.Filtro, Usuario.Id, out totalRegistros);
                if (result.Any())
                {
                    if (model.Filtro.PaginationParameters.PageIndex == 0 && result.Count == 1)
                    {
                        Session["Filtro"] = null;

                        return(PartialView("Redirect", Url.Action("Liberacao", "LiberacaoContrato", new { id = result[0].Id })));
                    }
                    else
                    {
                        var listaViewModel = CreateListaViewModel(model.Filtro.PaginationParameters, totalRegistros, result);
                        return(PartialView("ListaPartial", listaViewModel));
                    }
                }
                return(PartialView("_EmptyListPartial"));
            }
            return(PartialView("_NotificationMessagesPartial"));
        }
Exemplo n.º 2
0
        public ActionResult Index()
        {
            var model = Session["Filtro"] as LiberacaoContratoListaViewModel;

            if (model == null)
            {
                model = new LiberacaoContratoListaViewModel();
                model.Filtro.PaginationParameters.PageSize         = this.DefaultPageSize;
                model.Filtro.PaginationParameters.UniqueIdentifier = GenerateUniqueIdentifier();
            }

            return(View(model));
        }