public void InsertAircraftConfiguration(AircraftConfigurationDTO aircraftConfiguration) { AircraftConfiguration newAircraftConfiguration = AircraftConfigurationFactory.CreateAircraftConfiguration(); AircraftConfigurationFactory.SetAircraftConfiguration(newAircraftConfiguration, aircraftConfiguration.ConfigCode, aircraftConfiguration.AircraftSeriesId, aircraftConfiguration.AircraftTypeId, aircraftConfiguration.BEW, aircraftConfiguration.BW, aircraftConfiguration.BWF, aircraftConfiguration.BWI, aircraftConfiguration.Description, aircraftConfiguration.MCC, aircraftConfiguration.MLW, aircraftConfiguration.MMFW, aircraftConfiguration.MTOW, aircraftConfiguration.MTW, aircraftConfiguration.MZFW, aircraftConfiguration.FileName, aircraftConfiguration.FileContent); aircraftConfiguration.AircraftCabins.ToList() .ForEach(aircraftCabin => InsertAircraftCabin(newAircraftConfiguration, aircraftCabin)); _aircraftConfigurationRepository.Add(newAircraftConfiguration); }
public void DeleteAircraftConfiguration(AircraftConfigurationDTO aircraftConfiguration) { AircraftConfiguration deleteAircraftConfiguration = _aircraftConfigurationRepository.Get(aircraftConfiguration.Id); //获取需要删除的对象。 _aircraftConfigurationRepository.DeleteAircraftConfiguration(deleteAircraftConfiguration); //删除飞机配置类型。 }
public void ModifyAircraftConfiguration(AircraftConfigurationDTO aircraftConfiguration) { AircraftConfiguration updateAircraftConfiguration = _aircraftConfigurationRepository.Get(aircraftConfiguration.Id); //获取需要更新的对象。 AircraftConfigurationFactory.SetAircraftConfiguration(updateAircraftConfiguration, aircraftConfiguration.ConfigCode, aircraftConfiguration.AircraftSeriesId, aircraftConfiguration.AircraftTypeId, aircraftConfiguration.BEW, aircraftConfiguration.BW, aircraftConfiguration.BWF, aircraftConfiguration.BWI, aircraftConfiguration.Description, aircraftConfiguration.MCC, aircraftConfiguration.MLW, aircraftConfiguration.MMFW, aircraftConfiguration.MTOW, aircraftConfiguration.MTW, aircraftConfiguration.MZFW, aircraftConfiguration.FileName, aircraftConfiguration.FileContent); List<AircraftCabinDTO> dtoAircraftCabins = aircraftConfiguration.AircraftCabins; ICollection<AircraftCabin> aircraftCabins = updateAircraftConfiguration.AircraftCabins; DataHelper.DetailHandle(dtoAircraftCabins.ToArray(), aircraftCabins.ToArray(), c => c.Id, p => p.Id, i => InsertAircraftCabin(updateAircraftConfiguration, i), UpdateAircraftCabin, d => _aircraftConfigurationRepository.DeleteAircraftCabin(d)); _aircraftConfigurationRepository.Modify(updateAircraftConfiguration); }