public async Task <IActionResult> PostComment(PostCommentData data) { var err = new PostCommentData(); if (await data.CheckPostData(err, _context)) { var comment = new Comment() { TopicId = int.Parse(data.TopicId), ParentCommentId = data.ParentCommentId == null ? null : (int?)int.Parse(data.ParentCommentId), Username = User.Identity.Name, Text = data.Text, Date = DateTime.Now, Score = 0 }; await _context.AddComment(comment); return(Ok()); } return(BadRequest(err)); }