Ejemplo n.º 1
0
        public async Task <RankReward> AddRankReward(RankReward rankReward)
        {
            _konekoContext.RankRewards.Add(rankReward);
            await _konekoContext.SaveChangesAsync();

            return(rankReward);
        }
Ejemplo n.º 2
0
        public async Task <BotResponse> AddBotResponse(BotResponse botResponse)
        {
            await _konekoContext.BotResponses.AddAsync(botResponse);

            await _konekoContext.SaveChangesAsync();

            return(botResponse);
        }
Ejemplo n.º 3
0
        public async Task <AdvanceImage> AddAdvanceImage(AdvanceImage advanceImage)
        {
            if (advanceImage is null)
            {
                return(null);
            }

            await _konekoContext.AdvanceImages.AddAsync(advanceImage);

            await _konekoContext.SaveChangesAsync();

            return(advanceImage);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        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);
        }