public async Task <RankReward> AddRankReward(RankReward rankReward) { _konekoContext.RankRewards.Add(rankReward); await _konekoContext.SaveChangesAsync(); return(rankReward); }
public async Task <BotResponse> AddBotResponse(BotResponse botResponse) { await _konekoContext.BotResponses.AddAsync(botResponse); await _konekoContext.SaveChangesAsync(); return(botResponse); }
public async Task <AdvanceImage> AddAdvanceImage(AdvanceImage advanceImage) { if (advanceImage is null) { return(null); } await _konekoContext.AdvanceImages.AddAsync(advanceImage); await _konekoContext.SaveChangesAsync(); return(advanceImage); }
public async Task <Configuration> SetConfiguration(Configuration configuration) { await _konekoContext .Upsert(configuration) .On(k => new { k.Key, k.GuildId }) .WhenMatched(k => new Configuration { Value = configuration.Value }).RunAsync(); _memoryCache.Remove(GetKey(configuration.GuildId, configuration.Key)); await _konekoContext.SaveChangesAsync(); return(configuration); }
public async Task <AudioRating> SetAudioRating(AudioRating audioRating) { if (audioRating is null) { return(null); } await _konekoContext.AudioRatings .Upsert(audioRating) .On(k => new { k.AudioIdentifier, k.GuildId, k.UserId }) .WhenMatched(k => new AudioRating { LikeType = k.LikeType == audioRating.LikeType ? LikeType.None : audioRating.LikeType }).RunAsync(); await _konekoContext.SaveChangesAsync(); return(audioRating); }