Exemplo n.º 1
0
        public async Task <IActionResult> Add(string postId, string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return(Redirect("/Post?postId=" + postId));
            }

            ApplicationUser user = await _userManager.GetUserAsync(HttpContext.User);

            Comment comment = new Comment(text);

            _repository.AddComment(comment, Guid.Parse(user.Id), Guid.Parse(postId));

            return(Redirect("/Post?postId=" + postId));
        }