public List<tests> getspecifictest(int k) { var Emplist = new List<tests>(); onlinetestingEntities4 newt = new onlinetestingEntities4(); foreach (var i in newt.tests.ToList()) { if (i.test_id == k) { tests t1 = new tests(); t1.test_id = i.test_id; t1.Id = i.id; t1.Ques = i.question; t1.option1 = i.option1; t1.option2 = i.option2; t1.option3 = i.option3; t1.option4 = i.option4; t1.Right_ans = i.right_ans; Emplist.Add(t1); } } return Emplist; }
public bool insertTest(tests testInsert) { onlinetestingEntities4 t1 = new onlinetestingEntities4(); test newt = new test(); newt.id = testInsert.Id; newt.test_id = testInsert.test_id; newt.question = testInsert.Ques; newt.option1 = testInsert.option1; newt.option2 = testInsert.option2; newt.option3 = testInsert.option3; newt.option4 = testInsert.option4; newt.right_ans = testInsert.Right_ans; t1.tests.Add(newt); t1.SaveChanges(); return true; }
public List<tests> gettest() { var Emplist = new List<tests>(); onlinetestingEntities4 t1 = new onlinetestingEntities4(); foreach( var i in t1.tests.ToList()) { tests obj1 = new tests(); obj1.Id = i.id; obj1.test_id = i.test_id; obj1.Ques = i.question; obj1.option1 = i.option1; obj1.option2 = i.option2; obj1.option3 = i.option3; obj1.option4 = i.option4; Emplist.Add(obj1); } return Emplist; }