コード例 #1
0
 public ActionResult AddComment([FromBody] Comment commentDTO)
 {
     logger.LogInformation("AddComment method was called.");
     if (String.IsNullOrEmpty(commentDTO.Owner))
     {
         throw new ValidationException("Validation error: comment owner field is empty!");
     }
     else if (String.IsNullOrEmpty(commentDTO.Text))
     {
         throw new ValidationException("Validation error: comment text is empty!");
     }
     newsManager.AddComment(commentDTO);
     return(Ok());
 }