public void DeleteRelation(Post post, Term term) { TermRelation relation = db.TermRelations.Where(tr => tr.PostID == post.PostID && tr.TermID == term.TermID).Single(); db.TermRelations.Remove(relation); db.SaveChanges(); }
public void AddRelation(Post post, Term[] terms) { foreach (Term term in terms) { TermRelation relation = new TermRelation(); relation.PostID = post.PostID; relation.TermID = term.TermID; db.TermRelations.Add(relation); db.SaveChanges(); } }
public TermPair(Term term1, Term term2, TermRelation relation) // Problem: TermPair too different from TermSet { Term1 = term1; Term2 = term2; Relation = relation; }