Esempio n. 1
0
 public Comment Create(User user, News publication, String content)
 {
     if (String.IsNullOrEmpty(content) || user == null)
         throw new ArgumentException(ERROR_CREATE_COMMENT);
     Comment comment = new Comment()
     {
         Owner = user,
         Content = content,
         Publication = publication,
         DatePublication = DateTime.Now,
         CommentId = Guid.NewGuid()
     };
     _database.Comments.Add(comment);
     return comment;
 }
Esempio n. 2
0
 public void Delete(Comment comment)
 {
     if (comment == null)
         throw new ArgumentException(ERROR_DELETE_COMMENT);
     _database.Comments.Remove(comment);
 }