예제 #1
0
        public async Task <Guid> HandleAsync(CreateLegacyNotificationApplication message)
        {
            var notification =
                await
                notificationApplicationFactory.CreateLegacy(
                    message.NotificationType,
                    message.CompetentAuthority,
                    message.Number);

            notificationApplicationRepository.Add(notification);

            await context.SaveChangesAsync();

            var facilityCollection = new FacilityCollection(notification.Id);
            var carrierCollection  = new CarrierCollection(notification.Id);
            var producerCollection = new ProducerCollection(notification.Id);

            facilityRepository.Add(facilityCollection);
            carrierRepository.Add(carrierCollection);
            producerRepository.Add(producerCollection);

            await context.SaveChangesAsync();

            return(notification.Id);
        }
        public async Task <Guid> HandleAsync(CreateNotificationApplication command)
        {
            var authority = command.CompetentAuthority;

            var notification = await notificationApplicationFactory.CreateNew(command.NotificationType, authority);

            notificationApplicationRepository.Add(notification);

            await context.SaveChangesAsync();

            var facilityCollection = new FacilityCollection(notification.Id);
            var carrierCollection  = new CarrierCollection(notification.Id);
            var producerCollection = new ProducerCollection(notification.Id);

            facilityRepository.Add(facilityCollection);
            carrierRepository.Add(carrierCollection);
            producerRepository.Add(producerCollection);

            await context.SaveChangesAsync();

            return(notification.Id);
        }