예제 #1
0
        public async Task <WeeklyResponse> ClaimWeeklyTest(GuildUserReference guildUserReference)
        {
            await using var unit = NewContext();
            var userService        = new UserService(unit, null);
            var transactionService = new TransactionService(userService);
            var guildService       = new GuildService(unit, transactionService);

            return(await guildService.ClaimWeeklyAsync(guildUserReference));
        }
예제 #2
0
 /// <summary>
 /// Creates and returns the Timer regardless of business errors.
 /// </summary>
 public static async Task <Timer> GetOrCreateTimerAsync(
     this IGuildService service, GuildUserReference guildUser)
 {
     try
     {
         return(await service.GetTimerAsync(guildUser));
     }
     catch (EntityNullException <Timer> )
     {
         return(await service.CreateTimerAsync(guildUser));
     }
 }
예제 #3
0
 /// <summary>
 /// Creates and returns the LocalExperience regardless of business errors.
 /// </summary>
 public static async Task <LocalExperience> GetOrCreateLocalExperienceAsync(
     this IGuildService service, GuildUserReference guildUser)
 {
     try
     {
         return(await service.GetLocalExperienceAsync(guildUser));
     }
     catch (EntityNullException <LocalExperience> )
     {
         return(await service.CreateLocalExperienceAsync(guildUser));
     }
 }