Ejemplo n.º 1
0
        // GET: Exams/Create
        public ActionResult Create()
        {
            var examVM = new ExamVM();

            examVM.CourseIdSelectList = SelectListHelper.CreateCourseSelectList();

            examVM.StudentIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateStudentsSelectList());

            return(View(examVM));
        }
Ejemplo n.º 2
0
/*
 *      public List<string> GetBreadCrumbs(BaseVM model) {
 *              var innerModel = model.Parts.Select(x => x.Model).FirstOrDefault();
 *                      if(innerModel == null)
 *                              return new List<string>();
 *          return GetBreadCrumbs((dynamic)innerModel);
 *      }
 */

        public List <string> GetBreadCrumbs(ExamVM model)
        {
            var breadcrumb = new List <string>();

            if (model.Exam.Vendor != null)
            {
                var vendor = model.Exam.Vendor;
                breadcrumb.Add(_helper.VendorLink(vendor));
                breadcrumb.Add(_helper.VendorExamLink(vendor));
            }
            return(breadcrumb);
        }
Ejemplo n.º 3
0
        public static Exam ExamVMToExam(ExamVM examVM)
        {
            var exam = new Exam
            {
                ExamId    = examVM.ExamId,
                CourseId  = examVM.CourseId,
                StudentId = examVM.StudentId,
                Date      = (DateTime)examVM.Date
            };

            if (examVM.Grade != null)
            {
                exam.Grade = double.Parse(examVM.Grade);
            }

            return(exam);
        }
Ejemplo n.º 4
0
        public static ExamVM ExamToExamVM(Exam exam)
        {
            var examsRepo = new ExamsRepository();

            var examVM = new ExamVM
            {
                ExamId    = exam.ExamId,
                CourseId  = exam.CourseId,
                StudentId = exam.StudentId,
                Date      = exam.Date,
                Grade     = (exam.Grade.HasValue) ? Math.Round((double)exam.Grade, 2).ToString("F2") : "absent",
                Course    = examsRepo.GetBasicCourseDetails(exam.ExamId),
                Student   = examsRepo.GetStudentDetails(exam.ExamId)
            };

            return(examVM);
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "ExamId,CourseId,StudentId,Date,Grade")] ExamVM examVM)
        {
            if (ModelState.IsValid)
            {
                Exam exam = ExamMap.ExamVMToExam(examVM);

                examsRepo.Add(exam);

                return(RedirectToAction("Index"));
            }

            examVM.CourseIdSelectList = (SelectListHelper.CreateCourseSelectList(examVM.CourseId));

            examVM.StudentIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateStudentsSelectList(), examVM.StudentId);

            return(View(examVM));
        }
Ejemplo n.º 6
0
        public ActionResult ExamResult()
        {
            //BasExamContext context = new BasExamContext();
            ExamVM Exvm = new ExamVM();

            //List<Exam> Examliste = context.Exams.ToList();
            //Exvm.Examlist = Examliste;
            Exvm.ClassList = cRepo.GetAll().Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();
            Exvm.SectionList = sectionrepo.GetAll().Select(x => new SelectListItem
            {
                Text  = x.Name,
                Value = x.Id.ToString()
            }).ToList();
            return(View(Exvm));
        }
Ejemplo n.º 7
0
        public virtual ActionResult Details(string urlName)
        {
            var exam = ExamService.GetByNumber(urlName);

            if (exam == null)
            {
                return(null);
            }
            var cityTC = UserSettingsService.CityTC;
            var groups =
                exam.Courses.SelectMany(c => GroupService.GetGroupsForCourse(c.Course_TC)
                                        .ByCity(cityTC)).Distinct().OrderBy(g => g.DateBeg)
                .Take(CommonConst.AnnounceCount);
            var model = new ExamVM {
                Exam   = exam,
                Groups = groups.ToList()
            };

            return(View(model));
        }
Ejemplo n.º 8
0
 private static string GetTitle(ExamVM model)
 {
     return("Экзамен № {0} {1} в Специалисте".FormatWith(model.Exam.Exam_TC, model.Exam.ExamName));
 }