public IHttpActionResult CreateCar(CarDTO carDto) { Car car = _carConverter.Convert( carDto ); car = _maintenanceTrackerRepository.CreateCar( car ); carDto.Id = car.Id; return Ok(carDto); }
public Car Convert(CarDTO car) { return new Car { Id = car.Id, Year = car.Year, CarMakeId = car.Make.Id, Make = new CarMake { Id = car.Make.Id, Name = car.Make.Name }, CarModelId = car.Model.Id, Model = new CarModel { Id = car.Model.Id, Name = car.Model.Name }, Name = car.Name, Vin = car.Vin }; }
public IHttpActionResult UpdateCar(CarDTO carDto) { Car car = _carConverter.Convert( carDto ); _maintenanceTrackerRepository.UpdateCar( car ); return Ok( carDto ); }