コード例 #1
0
        public ActionResult Delete(int id)
        {
            var projection = _offlineTestPaper.GetOfflineTestById(id);

            if (projection == null)
            {
                _logger.Warn(string.Format("Exam Schedule does not Exists {0}.", id));
                Warning("Exam Schedule does not Exists.");
                return(RedirectToAction("Index"));
            }
            var viewModel  = AutoMapper.Mapper.Map <OfflineTestPaperProjection, OfflineTestPaperViewModel>(projection);
            var BranchList = _branchService.GetBranchByMultipleBranchId(projection.SelectedBranches).Select(x => x.Name).ToList();

            viewModel.SelectedBranchesName = string.Join(",", BranchList);

            var BatchList = _batchService.GetBatchesByBatchIds(projection.SelectedBatches).Select(x => x.BatchName).ToList();

            viewModel.SelectedBatchesName = string.Join(",", BatchList);
            return(View(viewModel));
        }
        public ActionResult GetOfflineTestById(int OfflineTestPaperId)
        {
            var offlineTest = _offlineTestPaper.GetOfflineTestById(OfflineTestPaperId);

            var BranchList           = _branchService.GetBranchByMultipleBranchId(offlineTest.SelectedBranches).Select(x => x.Name).ToList();
            var SelectedBranchesName = string.Join(",", BranchList);

            var BatchList           = _batchService.GetBatchesByBatchIds(offlineTest.SelectedBatches).Select(x => x.BatchName).ToList();
            var SelectedBatchesName = string.Join(",", BatchList);
            var tests = new
            {
                className   = offlineTest.ClassName,
                subjectName = offlineTest.SubjectName,
                batchName   = SelectedBatchesName,
                branchName  = SelectedBranchesName,
                branchId    = offlineTest.SelectedBranches,
                batchId     = offlineTest.SelectedBatches,
                classId     = offlineTest.ClassId,
                totalMarks  = offlineTest.TotalMarks
            };

            return(Json(tests, JsonRequestBehavior.AllowGet));
        }