コード例 #1
0
 public IActionResult PostPerfilVehiculo(int idUsuario, [FromBody] PerfilVehiculoDTO perfilVehiculoDto)
 {
     try
     {
         var vehiculo = vehiculoService.Crear(vehiculoMapper.FromPerfilVehiculoDTO(perfilVehiculoDto), idUsuario);
         return(StatusCode(StatusCodes.Status201Created, vehiculoMapper.ToPerfilVehiculoDTO(vehiculo)));
     }
     catch (FormatException fe)
     {
         return(UnprocessableEntity(new ErrorResponse(StatusCodes.Status422UnprocessableEntity, fe.Message)));
     }
     catch (Exception e)
     {
         return(errorResponseFactory.InternalServerErrorResponse(e));
     }
 }
コード例 #2
0
        public async Task <IActionResult> Crear(VehiculoDto vehiculo)
        {
            await _vehiculoService.Crear(_mapper.Map <Vehiculo>(vehiculo));

            return(Ok());
        }