Beispiel #1
0
        public IActionResult Listar(DataTableModel <VehiculoFilterDto> dataTableModel)
        {
            var jsonResponse = new JsonResponseDto()
            {
                Type = Constante.Error
            };

            try
            {
                FormatDataTable(dataTableModel);
                var jsonResponseDto = new JsonResponseDto()
                {
                    Type = Constante.Error
                };

                var paginationParameter = new PaginationParameter
                {
                    Start       = dataTableModel.start,
                    AmountRows  = dataTableModel.length,
                    WhereFilter = dataTableModel.whereFilter,
                    OrderBy     = dataTableModel.orderBy
                };

                List <VehiculoPaginationDto> lstCampania = _Vehiculo.PaginadoVehiculo(paginationParameter, dataTableModel.filter);
                if (!string.IsNullOrWhiteSpace(dataTableModel.filter.DigitalizacionSearch))
                {
                    lstCampania = lstCampania.Where(p => p.Digitalizacion == dataTableModel.filter.DigitalizacionSearch).ToList();
                }
                var tipo_empresa = GetTipoEmpresa();
                var idEmpresa    = GetEmpresa();
                dataTableModel.data = lstCampania;
                if (lstCampania.Count > 0)
                {
                    dataTableModel.recordsTotal    = lstCampania[0].Cantidad;
                    dataTableModel.recordsFiltered = dataTableModel.recordsTotal;
                }
            }


            catch (Exception ex)
            {
                _logger.LogError(ex.Message);
                jsonResponse.Mensaje = ex.Message;
            }
            return(Json(dataTableModel));
        }