Esempio n. 1
0
        public Task <Boolean> BlacklistContainsAsync(String tag, String reason)
        {
            const String key = "boorus:blacklist";

            var blacklistObj = new BlacklistDto(tag, reason);

            return(this._db.SetContainsAsync(key, blacklistObj));
        }
Esempio n. 2
0
        // I HATE THESE NAMESKGJSFDNGHFJSDNNH
        public Task BlacklistAddAsync(String tag, String reason)
        {
            const String key = "boorus:blacklist";

            var blacklistObj = new BlacklistDto(tag, reason);

            return(this._db.SetAddAsync(key, blacklistObj));
        }
        public async Task <IActionResult> Post([FromBody] BlacklistDto blacklistDto)
        {
            //if (!User.Identity.IsAuthenticated) throw new AuthenticationException();
            var blacklist = _mapper.Map <Blacklist>(blacklistDto);
            await _blacklistService.InsertBlacklist(blacklist);

            blacklistDto = _mapper.Map <BlacklistDto>(blacklist);
            var response = new ApiResponse <BlacklistDto>(blacklistDto);

            return(Ok(response));
        }
        public async Task <IActionResult> Put(int id, BlacklistDto blacklistDto)
        {
            if (!User.Identity.IsAuthenticated)
            {
                throw new AuthenticationException();
            }
            var blacklist = _mapper.Map <Blacklist>(blacklistDto);

            blacklist.Id = id;
            var result = await _blacklistService.UpdateBlacklist(blacklist);

            var response = new ApiResponse <bool>(result);

            return(Ok(response));
        }