Пример #1
0
 public ProfilesService(IMaskedEmailsDbContext context, IUniqueIdGenerator generator, IMaskedEmailCommandService commands, IOptions <AppSettings> settings)
 {
     context_   = context;
     generator_ = generator;
     commands_  = commands;
     settings_  = settings;
 }
 public static async Task RemoveMaskedEmailAsync(this IMaskedEmailCommandService service
                                                 , string address)
 {
     var addCommand = new RemoveMaskedEmailCommand
     {
         Address = address,
     };
     await service.QueueCommandAsync(addCommand);
 }
        public static async Task CreateMaskedEmailAsync(this IMaskedEmailCommandService service
                                                        , string address
                                                        , string forwardTo
                                                        , string passwordHash
                                                        , bool forwardingEnabled = true)
        {
            var addCommand = new CreateMaskedEmailCommand
            {
                Address          = address,
                AlternateAddress = forwardTo,
                PasswordHash     = passwordHash,
            };
            await service.QueueCommandAsync(addCommand);

            if (!forwardingEnabled)
            {
                await service.DisableMaskedEmailAsync(address);
            }
        }