コード例 #1
0
 public SettingsModule(IMapper mapper,
                       IUserNotificationSettingsService settingsService)
     : base(mapper, "notification/settings", false)
 {
     Get("/{userId}", async args => await Fetch <GetUserNotificationSettings, UserNotificationSettings>
             (async x => await settingsService.GetSettingsAsync(x.UserId))
         .MapTo <UserNotificationSettingsDto>()
         .HandleAsync());
 }
コード例 #2
0
 public async Task HandleAsync(UsernameChanged @event)
 {
     await _handler
     .Run(async() =>
     {
         var settings            = await _settingsService.GetSettingsAsync(@event.UserId);
         settings.Value.Username = @event.NewName;
         await _settingsService.UpdateSettingsAsync(settings.Value);
     })
     .OnError((ex, logger) => logger.Error(ex, $"Error while updating username, userId: {@event.UserId}"))
     .ExecuteAsync();
 }