public ActionResult ArrengeTest(int Id) { var testList = _testPaperService.GetPaperById(Id); var distinctBranchList = _studentService.GetBranchesTestByClassId(testList.ClassId).Select(x => new { x.BranchId, x.BranchName }).Distinct().ToList(); var branchList = (from b in distinctBranchList select new SelectListItem { Value = b.BranchId.ToString(), Text = b.BranchName }).ToList(); ViewBag.classId = testList.ClassId; ViewBag.TestPaperId = testList.TestPaperId; var batchList = (from b in _batchService.GetAllBatchClsId(testList.ClassId) select new SelectListItem { Value = b.BatchId.ToString(), Text = b.BatchName /*+ " (" + b.SubjectName + " )"*/ }).ToList(); ViewBag.BranchId = null; return(View(new TestPaperDeleteViewModel { Branches = branchList, ClassName = testList.ClassName, Title = testList.Title, TestType = testList.TestType, Batches = batchList, SubjectName = testList.SubjectName })); }
public ActionResult GetBatches(int classId) { var batches = _batchService.GetAllBatchClsId(classId).Select(x => new { x.BatchId, x.BatchName }); return(Json(batches, JsonRequestBehavior.AllowGet)); }