public async Task <IActionResult> AddVehicle(CreateVehicleRequestModel createVehicleRequestModel) { if (createVehicleRequestModel.RaceId < 0) { return(BadRequest()); } var vehicleDto = VehicleFactory.CreateVehicle(createVehicleRequestModel); if (vehicleDto == null) { return(BadRequest()); } var result = await raceService.AddVehicle(vehicleDto); if (!result.ResultInfo.IsOk) { return(Conflict(result.ResultInfo.Error)); } return(Ok()); }
public IHttpActionResult Post(int raceId, Vehicle model) { Vehicle vehicle = _raceService.AddVehicle(raceId, model); return(CreatedAtOrNotFound("GetVehicle", new { id = vehicle?.Id }, vehicle)); }