Exemple #1
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }
            CommentDTO comment = new CommentDTO(); // acest tip este vazut in serviciu
            int        postId  = 0;

            postId             = id.Value;
            comment.PostPostId = postId;
            comment.Text       = CommentDTO.Text;
            var result = await pcc.AddCommmentAsync(id.Value, comment);

            if (result == null)
            {
                return(RedirectToAction("Error"));
            }
            return(RedirectToPage("/Posts/Index"));
        }