/// <summary> /// Обновить информацию после окончательного ответа. При отмене - удалить пакет /// </summary> public async Task <Unit> UpdateFromResponse(PackageDataShortResponseServer packageDataShortResponseServer) { using var unitOfWork = _container.Resolve <IUnitOfWork>(); var filesDataEntity = await unitOfWork.Session.LoadAsync <PackageDataEntity>(packageDataShortResponseServer.Id.ToString()); if (!await DeleteFilesDataOnAbortionStatus(unitOfWork, filesDataEntity)) { ConverterFilesDataEntitiesFromDtoServer.UpdatePackageDataFromShortResponse(filesDataEntity, packageDataShortResponseServer); } await unitOfWork.CommitAsync(); return(Unit.Value); }
/// <summary> /// Обновить модель базы данных на основе промежуточного ответа /// </summary> public static PackageDataEntity UpdatePackageDataFromShortResponse(PackageDataEntity packageDataEntity, PackageDataShortResponseServer packageDataShortResponse) { packageDataEntity.StatusProcessingProject = packageDataShortResponse.StatusProcessingProject; var filesDataIntermediateEntity = packageDataEntity.FileDataEntities. Join(packageDataShortResponse.FilesData, fileEntity => fileEntity.FilePath, filesIntermediateResponse => filesIntermediateResponse.FilePath, UpdateFileDataFromShortResponse). ToList(); packageDataEntity.FileDataEntities = filesDataIntermediateEntity; return(packageDataEntity); }
/// <summary> /// Обновить информацию после окончательного ответа /// </summary> public async Task <Unit> UpdateFromResponse(PackageDataShortResponseServer packageDataShortResponseServer) => await _filesDataServerService.UpdateFromResponse(packageDataShortResponseServer);