public async Task <IActionResult> Put(int id, [FromBody] VehicleModelRest changeModel) { if (id != changeModel.VehicleModelId) { return(BadRequest()); } if (await Service.ModelExists(id)) { await Service.UpdateVehicleModelAsync(id, Mapper.Map <Vehicle.Model.VehicleModel>(changeModel)); return(Ok()); } return(NoContent()); }
public async Task <IActionResult> Post([FromBody] VehicleModelRest newModel) { await Service.AddVehicleModelAsync(Mapper.Map <Vehicle.Model.VehicleModel>(newModel)); return(CreatedAtAction(nameof(Get), new { id = newModel.VehicleModelId }, newModel)); }