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)); }
/// <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)); } }
/// <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)); } }