コード例 #1
0
        public IHttpActionResult CreateCar(CarDTO carDto)
        {
            Car car = _carConverter.Convert( carDto );

            car = _maintenanceTrackerRepository.CreateCar( car );

            carDto.Id = car.Id;

            return Ok(carDto);
        }
コード例 #2
0
 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
     };
 }
コード例 #3
0
 public IHttpActionResult UpdateCar(CarDTO carDto)
 {
     Car car = _carConverter.Convert( carDto );
     _maintenanceTrackerRepository.UpdateCar( car );
     return Ok( carDto );
 }