Exemple #1
0
 public IActionResult AddNewComment(int id, string author, string text)
 {
     if (!string.IsNullOrWhiteSpace(text) && text.Length > 0)
     {
         var commentId  = _cardRepository.AddNewComment(id, author, text);
         var newComment = _commentManager.Get(commentId);
         var date       = newComment.CreationDate.ToLocalTime().ToString();
         var authorName = newComment.Author;
         return(Json(new
         {
             success = true,
             id = commentId,
             date,
             name = authorName
         }));
     }
     else
     {
         return(Json(new { success = false }));
     }
 }