예제 #1
0
 public IActionResult Get([FromQuery] ParametrosBusquedaVehiculo parametros)
 {
     try
     {
         parametrosValidator.Validate(parametros);
         return(Ok(vehiculoMapper.ToVehiculoDTOList(vehiculoService.Listar(parametros))));
     }
     catch (ValidationException ve)
     {
         Console.WriteLine(ve);
         return(BadRequest(new ErrorResponse(StatusCodes.Status400BadRequest, ve.Message)));
     }
     catch (FormatException fe)
     {
         Console.WriteLine(fe);
         return(UnprocessableEntity(new ErrorResponse(StatusCodes.Status422UnprocessableEntity, fe.Message)));
     }
     catch (Exception e)
     {
         return(errorResponseFactory.InternalServerErrorResponse(e));
     }
 }