コード例 #1
0
 public IActionResult OnPost()
 {
     if (ModelState.IsValid)
     {
         //Comment.TargetId = Ad.Id;
         var identityClaim = _httpContext.HttpContext.User;
         var user          = _userService.GetUserAsync(identityClaim).Result;
         Comment.UserId    = user.Id;
         Comment.DateAdded = DateTime.Now;
         _commentService.AddCommentToUser(Comment);
     }
     return(RedirectToPage("UserProfile", new { userId = Comment.TargetId }));
 }