예제 #1
0
        public override async Task <PackageDTO> GetAsync(int id)
        {
            PackageDTO dto = await base.GetAsync(id);

            if (dto != null)
            {
                IEnumerable <PackageTravelUnit> travelUnitEntity = await this.UnitOfWork.PackageTravelUnitRepository.GetAsyncByEntity(dto.Id);

                IEnumerable <VehicleAssembly> assemblyEntity = await this.UnitOfWork.PackageVehicleAssemblyRepository.GetAsyncByEntity(dto.Id);

                IEnumerable <VehicleBodyType> bodytypeEntity = await this.UnitOfWork.PackageVehicleBodyTypeRepository.GetAsyncByEntity(dto.Id);

                IEnumerable <VehicleFeature> featureEntity = await this.UnitOfWork.PackageVehicleFeatureRepository.GetAsyncByEntity(dto.Id);

                IEnumerable <VehicleModel> modelEntity = await this.UnitOfWork.PackageVehicleModelRepository.GetAsyncByEntity(dto.Id);

                IEnumerable <VehicleTransmission> transmissionEntity = await this.UnitOfWork.PackageVehicleTransmissionRepository.GetAsyncByEntity(dto.Id);

                dto.TravelUnit          = PackageTravelUnitDTO.ConvertEntityListToDTOList <PackageTravelUnitDTO>(travelUnitEntity);
                dto.VehicleAssembly     = VehicleAssemblyDTO.ConvertEntityListToDTOList <VehicleAssemblyDTO>(assemblyEntity);
                dto.VehicleBodyType     = VehicleBodyTypeDTO.ConvertEntityListToDTOList <VehicleBodyTypeDTO>(bodytypeEntity);
                dto.VehicleFeature      = VehicleFeatureDTO.ConvertEntityListToDTOList <VehicleFeatureDTO>(featureEntity);
                dto.VehicleModel        = VehicleModelDTO.ConvertEntityListToDTOList <VehicleModelDTO>(modelEntity);
                dto.VehicleTransmission = VehicleTransmissionDTO.ConvertEntityListToDTOList <VehicleTransmissionDTO>(transmissionEntity);
            }

            return(dto);
        }
예제 #2
0
        private async Task saveDetails(PackageDTO dtoObject, PackageDTO result)
        {
            Package entity = result.ConvertToEntity();

            await this.UnitOfWork.PackageTravelUnitRepository.Create(PackageTravelUnitDTO.ConvertDTOListToEntity(dtoObject.TravelUnit), entity);

            await this.UnitOfWork.PackageVehicleAssemblyRepository.Create(VehicleAssemblyDTO.ConvertDTOListToEntity(dtoObject.VehicleAssembly), entity);

            await this.UnitOfWork.PackageVehicleBodyTypeRepository.Create(VehicleBodyTypeDTO.ConvertDTOListToEntity(dtoObject.VehicleBodyType), entity);

            await this.UnitOfWork.PackageVehicleFeatureRepository.Create(VehicleFeatureDTO.ConvertDTOListToEntity(dtoObject.VehicleFeature), entity);

            await this.UnitOfWork.PackageVehicleModelRepository.Create(VehicleModelDTO.ConvertDTOListToEntity(dtoObject.VehicleModel), entity);

            await this.UnitOfWork.PackageVehicleTransmissionRepository.Create(VehicleTransmissionDTO.ConvertDTOListToEntity(dtoObject.VehicleTransmission), entity);
        }