public async Task <ProvidedAnnexesData> HandleAsync(GetAnnexes message) { var annexRequirements = await requiredAnnexes.Get(message.NotificationId); var annexCollection = await annexCollectionRepository.GetByNotificationId(message.NotificationId); return(new ProvidedAnnexesData { ProcessOfGeneration = new AnnexStatus { IsRequired = annexRequirements.IsProcessOfGenerationRequired, FileId = annexCollection.ProcessOfGeneration.FileId }, TechnologyEmployed = new AnnexStatus { IsRequired = annexRequirements.IsTechnologyEmployedRequired, FileId = annexCollection.TechnologyEmployed.FileId }, WasteComposition = new AnnexStatus { IsRequired = annexRequirements.IsWasteCompositionRequired, FileId = annexCollection.WasteComposition.FileId } }); }
public async Task <bool> HandleAsync(DeleteAnnexFile message) { var annexCollection = await annexCollectionRepository.GetByNotificationId(message.NotificationId); annexCollection.RemoveAnnex(message.FileId); await context.SaveChangesAsync(); return(true); }
public async Task <bool> HandleAsync(SetProcessOfGenerationAnnex message) { var annexCollection = await annexCollectionRepository.GetByNotificationId(message.Annex.NotificationId); var file = annexFactory.CreateForNotification(nameGenerator, await notificationApplicationRepository.GetById(message.Annex.NotificationId), message.Annex.FileBytes, message.Annex.FileType); var fileId = await fileRepository.Store(file); annexCollection.SetProcessOfGenerationAnnex(new ProcessOfGenerationAnnex(fileId)); await context.SaveChangesAsync(); return(true); }