public void DropTest(TestsInClass TiC) { context.TestsInClasses.Remove(TiC); context.SaveChanges(); }
public void MakeActive(TestsInClass tic, int cid) { var classID = tic.ClassID; var curAct = context.TestsInClasses.FirstOrDefault(i => i.ClassID == classID && i.Active > 0); curAct.Active = 0; tic.Active = 1; context.Entry(curAct).State = System.Data.EntityState.Modified; context.Entry(tic).State = System.Data.EntityState.Modified; context.SaveChanges(); }
public int AddTest(int tid, int cid) { var newTiC = new TestsInClass { ClassID = cid, TestID = tid ,Active = 0}; context.TestsInClasses.Add(newTiC); var result = context.SaveChanges(); return result; }