public async Task <IActionResult> AddComment(CommentViewModel comment)
        {
            var username = _tokenReaderService.GetTokenUsername(HttpContext.Request.Headers["Authorization"]);

            var response = await _commentService.CreateComment(comment, username);

            return(Ok(response));
        }
        public async Task <IActionResult> GetNotifications()
        {
            var username = _tokenReaderService.GetTokenUsername(HttpContext.Request.Headers["Authorization"]);

            var response = await _service.GetNotificationsByUsername(username);

            return(Ok(response));
        }
        public async Task <IActionResult> CreatePost(PostViewModel post)
        {
            var username = _tokenReaderService.GetTokenUsername(HttpContext.Request.Headers["Authorization"]);

            var result = await _postService.CreatePost(post, username);

            return(Ok(result));
        }
        public async Task <IActionResult> Disconnect()
        {
            var username = _tokenReaderService.GetTokenUsername(HttpContext.Request.Headers["Authorization"]);
            await _identityService.Disconnect(username);

            return(Ok());
        }
Exemple #5
0
        public async Task <IActionResult> UpdateUser(string username, UpdateProfileViewModel data)
        {
            var requestingUser = _tokenReaderService.GetTokenUsername(HttpContext.Request.Headers["Authorization"]);

            var result = await _identityService.UpdateUserProfile(username, data, requestingUser);

            return(Ok(result));
        }
Exemple #6
0
        public async Task <IActionResult> GetSelfProfile()
        {
            var username = _tokenReaderService.GetTokenUsername(HttpContext.Request.Headers["Authorization"]);

            var response = await _identityService.GetUserProfileByUsername(username);

            return(Ok(response));
        }