public async Task <IActionResult> UploadComment(string comment, string userId, int associatedProject, int associatedBug) { var currentUserId = userManager.GetUserId(HttpContext.User); var currentUser = await userManager.FindByIdAsync(currentUserId); var currentUserClaims = await userManager.GetClaimsAsync(currentUser); GlobalVar.globalCurrentUserClaims = currentUserClaims.ToList(); try { Comment uploadedComment = new Comment { AssociatedBugId = associatedBug, ProjectId = associatedProject, UserId = userId, CommentText = comment, CreatedDate = DateTime.Now }; var newComment = _bugRepository.AddComment(uploadedComment); return(Json(new { status = "success", comment = newComment.CommentText, createdDate = newComment.CreatedDate, userId = newComment.UserId, commentId = newComment.Id, actionUrl = Url.Action("deletecomment", "bugcomment", new { commentId = newComment.Id }) })); } catch (Exception ex) { // to do : log error return(Json(new { status = "error", message = ex.Message })); } }