Example #1
0
        public async Task <IActionResult> AddVideoAndRemoveItFromRequested(VideoViewModel input, string userId)
        {
            var user = await userManager.FindByIdAsync(userId);

            await videoService.AddVideoAsync(input.Link, input.Title, input.Description, userId);

            await requestedVideoService.RemoveRequestedVideoAsync(input.Id);

            await emailSender.SendEmailAsync(user.Email, "Your Video:", GlobalConstants.MessageForGoodVideo);

            await messageService.AddMessageToUserAsync(GlobalConstants.MessageForGoodVideo, userId, null);

            return(Redirect("/Administration/RequestedVideo/AllRequestedVideos"));
        }
Example #2
0
        public async Task <IActionResult> CreateComment(CommentInputModel input, bool isAnswer)
        {
            var post = await postService.ByIdAsync(input.PostId);

            var user = await userManager.GetUserAsync(this.User);

            await commentService.CreateCommentAsync(input.PostId, user.Id, input.Content, input.ParentId, isAnswer);

            await messageService.AddMessageToUserAsync($"Your post was commented by {user.UserName}", post.UserId, post.Id);

            if (input.ParentId != 0)
            {
                var comment = await commentService.GetCommentByIdAsync(input.ParentId);

                await messageService.AddMessageToUserAsync($"Your comment was commented by {user.UserName}", comment.UserId, post.Id);
            }
            return(Redirect($"/Post/ById/{input.PostId}"));
        }