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; }
public void Delete(Comment comment) { if (comment == null) throw new ArgumentException(ERROR_DELETE_COMMENT); _database.Comments.Remove(comment); }