private void addCommentButton_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(newCommentTextBox.Text)) { Comment comment = new Comment() { Author = Program.AuthUser, EntityType = EntityType.Product, Text = newCommentTextBox.Text }; _presenter.ProductComments.Add(comment); newCommentTextBox.Text = string.Empty; _presenter.Save(); } }
protected bool Equals(Comment other) { return Equals(Author, other.Author) && string.Equals(Text, other.Text) && EntityType == other.EntityType; }
public void Delete(Comment entity) { dbContext.Comments.Remove(entity); dbContext.SaveChanges(); }
public void Update(Comment entity) { dbContext.Entry(entity).State = System.Data.Entity.EntityState.Modified; dbContext.SaveChanges(); }
public void Create(Comment entity) { dbContext.Comments.Add(entity); dbContext.SaveChanges(); }