public ActionResult Search2([Bind(Include = "PromotionStituation", Exclude = "StudentSituation")] SituationVM situationVM) { situationVM.StudentSituation = new StudentSituationFormVM(); situationVM.StudentSituation.StudentIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateStudentsSelectList()); if (ModelState.IsValid) { var promotionSituation = SituationMap.ConvertPromotionSituationVM(situationVM.PromotionStituation); if (studentsRepo.PromotionExists(promotionSituation)) { List <int> studentIDs = studentsRepo.GetPromotionIDs(promotionSituation); var finalSituation = SituationMap.GetPromotionStatistics(SituationMap.GetPromotionTableAux(studentIDs), promotionSituation); return(View("Situation2", finalSituation)); } ModelState.AddModelError(string.Empty, "The promotion you selected does not exist.Please try again."); return(View("Search", situationVM)); } return(View("Search", situationVM)); }
// GET: Courses/Create public ActionResult Create() { var courseVM = new CourseVM(); courseVM.TeacherIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateTeacherSelectList()); return(View(courseVM)); }
// GET: Exams/Create public ActionResult Create() { var examVM = new ExamVM(); examVM.CourseIdSelectList = SelectListHelper.CreateCourseSelectList(); examVM.StudentIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateStudentsSelectList()); return(View(examVM)); }
// GET: StudentSituations/Search public ActionResult Search() { var situationVM = new SituationVM { StudentSituation = new StudentSituationFormVM(), PromotionStituation = new ViewModels.PromotionSituationFormVM() }; situationVM.StudentSituation.StudentIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateStudentsSelectList()); return(View(situationVM)); }
public ActionResult Search([Bind(Include = "StudentSituation")] SituationVM situationVM) { if (ModelState.IsValid) { return(RedirectToAction("Situation", new { id = situationVM.StudentSituation.StudentId })); } situationVM.StudentSituation.StudentIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateStudentsSelectList(), situationVM.StudentSituation.StudentId); return(View(situationVM)); }
public ActionResult Create([Bind(Include = "CourseId,Name,TeacherId,Duration,Credits")] CourseVM coursVM) { if (ModelState.IsValid) { Cours course = CourseMap.CourseVMToCourse(coursVM); coursesRepo.Add(course); return(RedirectToAction("Index")); } coursVM.TeacherIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateTeacherSelectList(), coursVM.TeacherId); return(View(coursVM)); }
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)); }
// GET: Courses/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Cours cours = coursesRepo.GetById(id.Value); if (cours == null) { return(HttpNotFound()); } var courseVM = CourseMap.CourseToCourseVM(cours); courseVM.TeacherIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateTeacherSelectList(), courseVM.TeacherId); return(View(courseVM)); }
// GET: Exams/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Exam exam = examsRepo.GetById(id.Value); if (exam == null) { return(HttpNotFound()); } var examVM = ExamMap.ExamToExamVM(exam); examVM.CourseIdSelectList = (SelectListHelper.CreateCourseSelectList(examVM.CourseId)); examVM.StudentIdSelectList = SelectListHelper.CreateSelectListProp(SelectListHelper.PopulateStudentsSelectList(), examVM.StudentId); return(View(examVM)); }