public ActionResult Listar(jQueryDataTableParamModel param) { IList <Materia> result = new List <Materia>(); int totalReg = 0; try { //Monta palavra chave string palavraChave = (param.sSearch != null) ? param.sSearch.ToString() : string.Empty; MateriaService service = new MateriaService(); int skip = param.iDisplayStart; int take = param.iDisplayLength; result = service.Listar(skip, take, palavraChave); totalReg = service.TotalRegistros; } catch (Exception ex) { LogUtil.Error(ex); } List <string[]> listaDados = new List <string[]>(); foreach (var item in result) { listaDados.Add(new string[] { item.Nome, string.IsNullOrEmpty(item.CorBorda)?"":item.CorBorda, string.IsNullOrEmpty(item.CorFundo)?"":item.CorFundo, item.ID.ToString() }); } //Monta Json de Retorno JsonResult retorno = Json(new { sEcho = param.sEcho, iTotalRecords = totalReg, iTotalDisplayRecords = totalReg, aaData = listaDados }, JsonRequestBehavior.AllowGet); return(retorno); }