public RessultModel(List<Question> UserAnsweredQ,string userName,int testId) { AnsweredQuestions = UserAnsweredQ; this.userName = userName; TrueQuestions = new QuestionContext().Questions.Where(x => x.TestId == testId).ToList(); CalculateMark(); }
public static List <Question> GetQuestionsFromDb(this DAL.QuestionContext db, int pageNum, int testId, int QUESTIONSONPAGE) { List <Question> questions = db.Questions.AsNoTracking(). Where(i => i.TestId == testId).OrderBy(i => i.QuestionId). Skip(QUESTIONSONPAGE * pageNum - QUESTIONSONPAGE).Take(QUESTIONSONPAGE).ToList(); return(questions); }
public ActionResult Cabinet() { CabinetModel cabinet = new CabinetModel(); using (var db = new QuestionContext() ) { cabinet.tests = db.Tests.ToList(); } using (var db = new SaveContext()) { cabinet.RSM = db.Save.Where(x => x.UserName == HttpContext.User.Identity.Name).ToList(); } return View(cabinet); }