public void InsertChassis(ChassisDTO chassisDTO) { Chassis chassis = this.mapper.Map <Chassis>(chassisDTO); chassis.Cars = this.GetCarsByBrand(chassisDTO.Brands); this.unitOfWork.Chassiss.Add(chassis); this.unitOfWork.Complete(); }
public void ShouldMapChassisDTOToChassis() { //Arrange var chassis = new Chassis(); var chassisDTO = new ChassisDTO(); var chassisType = chassis.GetType(); //Act var result = Mapper.Map <Chassis>(chassisDTO); //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, chassisType); }
public void UpdateChassis(ChassisDTO chassisDTO) { Chassis chassis = unitOfWork.Chassiss.GetByCodeNumber(chassisDTO.CodeNumber); if (chassis != null) { chassis.Description = chassisDTO.Description; chassis.Cars = this.GetCarsByBrand(chassisDTO.Brands); this.unitOfWork.Chassiss.Update(chassis); this.unitOfWork.Complete(); } else { this.InsertChassis(chassisDTO); } }
public void Put([FromBody] ChassisDTO chassisDTO) { this.chassisService.UpdateChassis(chassisDTO); }
public void Post([FromBody] ChassisDTO chassisDTO) { this.chassisService.InsertChassis(chassisDTO); }