public ActionResult ExamPapers() { var examPapers = new List <ExamPaper>(); examPapers = examPaperService.GetAll().ToList(); ViewBag.CountExamPaper = examPapers.Count(); foreach (var item in examPapers) { item.NumberOfQuestion = examPaperService.GetNumberOfQuestionByExamPaperId(item.ExamPaperID); } return(View(examPapers)); }
public ActionResult Edit(int id) { ViewBag.listAllExamPaper = examPaperService.GetAll(); var listExamPaperByExamID = examService.GetExamPaperByExamID(id); foreach (var item in listExamPaperByExamID) { item.NumberOfQuestion = examPaperService.GetNumberOfQuestionByExamPaperId(item.ExamPaperID); } ViewBag.listExamPaperByExamID = listExamPaperByExamID; var exam = examService.GetExamsByID(id); return(View(exam)); }