예제 #1
0
        public async Task <ActionResult> Post([FromForm] VehiculoDTO vehiculoDTO)
        {
            vehiculoDTO.Foto = await _helperImage.Upload(vehiculoDTO.Image, directory);

            var vehiculo = _mapper.Map <Vehiculo>(vehiculoDTO);
            await _vehiculoService.InsertVehiculo(vehiculo);

            vehiculoDTO = _mapper.Map <VehiculoDTO>(vehiculo);
            var response = new ApiResponse <VehiculoDTO>(vehiculoDTO);

            return(Created(nameof(Get), new { id = vehiculo.Id, response }));
        }