Beispiel #1
0
        public async Task Subscribe(params string[] tags)
        {
            // make sure that there are tags
            if (tags.Length == 0)
            {
                return;
            }

            await _tagService.AddSubscibedTagsToUser(Context.User.Id, tags);

            await ReplyAsync("Succesfully subscribed to the tags.");
        }
Beispiel #2
0
        public async Task <IActionResult> SubscribeToTags(string[] tags)
        {
            if (tags == null || tags.Length == 0)
            {
                return(BadRequest("Action requires at least one tag."));
            }
            if (tags.Any(t => t.Contains(' ')))
            {
                return(BadRequest("Malformed data, cannot accept tag with space character."));
            }

            var userId = ulong.Parse(User.Claims.First(c => c.Type == ClaimTypes.NameIdentifier).Value);

            await _tagService.AddSubscibedTagsToUser(userId, tags);

            return(Ok());
        }