Example #1
0
        public JsonResult Pesquisar(DatatableParm parm, Manutencao item)
        {
            try
            {
                SalvarPesquisa(item, parm);
                var items = manutencaoService.GetAllByPage(item, parm);

                return(Json(new
                {
                    ok = true,
                    sEcho = parm.sEcho,
                    iTotalRecords = items.Count(),
                    iTotalDisplayRecords = parm.totalRecords,
                    aaData = items.Select(x => new
                    {
                        IdeManutencao = x.IdeManutencao,
                        IdcTipoManutencao = x.IdcTipoManutencao == "C"? "Corretiva": "Preventiva",
                        DthEntrada = x.DthEntrada.ToString("dd/MM/yyyy HH:mm"),
                        DthSaida = x.DthSaida.HasValue? x.DthSaida.Value.ToString("dd/MM/yyyy HH:mm"): string.Empty,
                        Veiculo = new {
                            IdeVeiculo = x.Veiculo.IdeVeiculo,
                            DscMarcaModelo = x.Veiculo.DscMarcaModelo
                        },
                        Colaborador = new {
                            IdeColaborador = x.Colaborador.IdeColaborador,
                            NomColaborador = x.Colaborador.NomColaborador
                        }
                    })
                }));
            }
            catch (Exception ex)
            {
                return(Json(CreateMessageDatatable(ex)));
            }
        }
        public JsonResult Pesquisar(DatatableParm parm, Manutencao item)
        {
            try
            {
                SalvarPesquisa(item, parm);
                var items = manutencaoService.GetAllByPage(item, parm);

                return(Json(new
                {
                    ok = true,
                    sEcho = parm.sEcho,
                    iTotalRecords = items.Count(),
                    iTotalDisplayRecords = parm.totalRecords,
                    aaData = items.Select(x => new
                    {
                        IdeManutencao = x.IdeManutencao
                    })
                }));
            }
            catch (Exception ex)
            {
                return(Json(CreateMessageDatatable(ex)));
            }
        }