public ActionResult CourseAssignToTeacher(CourseAssignToTeacher courseAssignToTeacher) { ViewBag.Message = courseAssignToTeacherManager.Save(courseAssignToTeacher); ViewBag.Departments = departmentManager.GetAll(); ViewBag.Teachers = teacherManager.GetAllTeacher(); ViewBag.Courses = courseManager.GetAll(); return(View()); }
public ActionResult CourseAssignToTeacher(CourseAssignToTeacher courseAssign) { List <Department> departments = departmentManager.GetAllDepartments(); ViewBag.Departments = departments; string msg = courseAssignToTeacher.Save(courseAssign); ViewBag.Messages = msg; return(View()); }
public ActionResult CourseAssignToTeacher(CourseAssignToTeacher courseAssign) { if (ModelState.IsValid) { string message = courseAssignToTeacherManager.Save(courseAssign); ViewBag.Departments = departmentManager.GetAllDepartmentsForDropdown(); ViewBag.Message = message; ModelState.Clear(); return(View()); } else { ViewBag.Message = "Model is not valid"; return(View()); } }
public ActionResult AssignCourseToTeacher(CourseAssignToTeacher courseAssign) { //ViewBag.Message = ""; List <Course> courses = courseManger.GetAllCourses(); List <Department> departments = departmentManager.GetAllDepts(); List <Teacher> teachers = teacherManager.GetAllTeachers(); if (ModelState.IsValid) { ViewBag.Message = courseAssignToTeacherManager.Save(courseAssign); } ViewBag.Courses = courses; ViewBag.Departments = departments; ViewBag.Teachers = teachers; return(View()); }
public ActionResult AssignCourseToTeacher(CourseAssignToTeacher courseAssign) { try { ViewBag.Message = courseAssignToTeacherManager.Save(courseAssign); IEnumerable <Course> courses = courseManger.GetAll; IEnumerable <Department> departments = departmentManager.GetAll(); IEnumerable <Teacher> teachers = teacherManager.GetAll; ViewBag.Courses = courses; ViewBag.Departments = departments; ViewBag.Teachers = teachers; return(View()); } catch (Exception exception) { ViewBag.Message = exception.InnerException.Message; return(View()); } }
public ActionResult Create(CourseTeacherViewModel aCourseTeacherViewModel) { try { IEnumerable <Department> departments = aDepartmentManager.GetAllDepartment(); ViewBag.DeptList = new SelectList(departments, "Id", "Name"); IEnumerable <Teacher> teachers = new List <Teacher>(); ViewBag.TeacherList = new SelectList(teachers, "Id", "Name"); IEnumerable <Course> courses = new List <Course>(); ViewBag.CourseList = new SelectList(courses, "Id", "Code"); string msg = aCourseAssignToTeacherManager.Save(aCourseTeacherViewModel); ViewBag.message = msg; ModelState.Clear(); return(View(new CourseTeacherViewModel())); } catch { return(View()); } }
public ActionResult Index(CourseAssignToTeacher courseAssignToTeacher) { try { int rowsAffected = courseAssignToTeacherManager.Save(courseAssignToTeacher); int updated = courseAssignToTeacherManager.UpdateTeacherRemainCredit(courseAssignToTeacher); if (rowsAffected > 0 && updated > 0) { ViewBag.Message = "Saved"; } else { ViewBag.Message = "Fail"; } } catch (Exception exception) { ViewBag.Message = exception.Message; } ViewBag.Departments = GetAllDepartments(); return(View()); }