public ActionResult Lista(TabelaBasicaViewModel model) { if (ModelState.IsValid) { Session["Filtro"] = model; int tipoTabela = 0; if (model == null) { model = new TabelaBasicaViewModel(); model.Filtro.PaginationParameters.PageSize = this.DefaultPageSize; } if (model.TipoTabelaId != null) { tipoTabela = (int)model.TipoTabelaId; } int totalRegistros; var result = tabelaBasicaAppService.ListarPeloFiltro(model.Filtro, out totalRegistros, (int)tipoTabela); if (result.Any()) { var listaViewModel = CreateListaViewModel(model.Filtro.PaginationParameters, totalRegistros, result); return(PartialView("ListaPartial", listaViewModel)); } return(PartialView("_EmptyListPartial")); } return(PartialView("_NotificationMessagesPartial")); }
public ActionResult Salvar(TabelaBasicaViewModel model) { if (ModelState.IsValid) { tabelaBasicaAppService.Salvar(model.TabelaBasica); } return(PartialView("_NotificationMessagesPartial")); }
public ActionResult Index(int?id) { TabelaBasicaDTO tabelaBasica = new TabelaBasicaDTO(); int tipoTabela = 0; var model = Session["Filtro"] as TabelaBasicaViewModel; if (model == null) { tipoTabela = 0; model = new TabelaBasicaViewModel(); model.Filtro.PaginationParameters.PageSize = this.DefaultPageSize; model.Filtro.PaginationParameters.UniqueIdentifier = GenerateUniqueIdentifier(); } model.PodeSalvar = tabelaBasicaAppService.EhPermitidoSalvar(); model.PodeDeletar = tabelaBasicaAppService.EhPermitidoDeletar(); model.PodeImprimir = tabelaBasicaAppService.EhPermitidoImprimir(); if (model.TipoTabelaId != null) { tipoTabela = (int)model.TipoTabelaId; } tabelaBasica = tabelaBasicaAppService.ObterPeloId(id, tipoTabela) ?? new TabelaBasicaDTO(); if (id.HasValue && !tabelaBasica.Id.HasValue) { messageQueue.Add(Application.Resource.Sigim.ErrorMessages.NenhumRegistroEncontrado, TypeMessage.Error); } model.TabelaBasica = tabelaBasica; CarregarCombos(model); model.TabelaBasica.TipoTabela = tipoTabela; return(View(model)); }
private void CarregarCombos(TabelaBasicaViewModel model) { model.ListaTipoTabela = new SelectList(typeof(TabelaBasicaFinanceiro).ToItemListaDTO(), "Id", "Descricao"); }