public void SaveQTest(QTest qtest) { if (qtest.QTestID == 0) { context.QTests.Add(qtest); } else { var _qtest = context.QTests.Find(qtest.QTestID); if (_qtest != null) { _qtest.Question = qtest.Question; _qtest.RightAnswer = qtest.RightAnswer; _qtest.WrongAnswers = qtest.WrongAnswers; } } context.SaveChanges(); }
public void DeleteQTests(QTest qtest) { context.QTests.Remove(qtest); //context.SaveChanges(); }