Exemplo n.º 1
0
        public void AddExam(Exams entityToAdd)
        {
            IExamsRepository repo = new ExamsRepository(getEntities());

            Entities.Exams entityToAdd2 = Mapper.Map <Exams, Entities.Exams>(entityToAdd);
            repo.Add(entityToAdd2);
        }
Exemplo n.º 2
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));
        }