private void CarregarCombos(MaterialListaViewModel model) { string sigla = string.Empty; if (model.Filtro != null) { sigla = model.Filtro.Sigla; } model.ListaUnidadeMedida = new SelectList(unidadeMedidaAppService.ListarTodos(), "Sigla", "Descricao", sigla); }
public ActionResult Index() { var model = Session["Filtro"] as MaterialListaViewModel; if (model == null) { model = new MaterialListaViewModel(); model.Filtro.PaginationParameters.PageSize = this.DefaultPageSize; } CarregarCombos(model); return(View(model)); }
public ActionResult Lista(MaterialListaViewModel model) { if (ModelState.IsValid) { Session["Filtro"] = model; int totalRegistros; if (string.IsNullOrEmpty(model.Filtro.PaginationParameters.OrderBy)) { model.Filtro.PaginationParameters.OrderBy = "id"; } var result = materialAppService.ListarPeloFiltro(model.Filtro, out totalRegistros); if (result.Any()) { var listaViewModel = CreateListaViewModel(model.Filtro.PaginationParameters, totalRegistros, result); return(PartialView("ListaPartial", listaViewModel)); } return(PartialView("_EmptyListPartial")); } return(PartialView("_NotificationMessagesPartial")); }