public ActionResult DeleteConfirmed(int id) { tblInstructorCourse tblInstructorCourse = _instructorCourseRepository.GetInstructorCourseById(id); _instructorCourseRepository.MySave(); return(RedirectToAction("Index")); }
public ActionResult Edit(InstructorCourseViewModel instructorCourseViewModel) { tblInstructorCourse tic = new tblInstructorCourse(); tic.Id = instructorCourseViewModel.Id; tic.CourseId = instructorCourseViewModel.CourseId; tic.InstructorId = instructorCourseViewModel.InstructorId; _instructorCourseRepository.MySave(); return(RedirectToAction("Index")); //ViewBag.CourseId = new SelectList(db.tblCourses, "Id", "CourseName", instructorCourseViewModel.CourseId); //ViewBag.InstructorId = new SelectList(db.tblInstructors, "Id", "InstructorName", instructorCourseViewModel.InstructorId); //return View(instructorCourseViewModel); }
public ActionResult Create(InstructorCourseViewModel instructorCourseViewModel) { if (ModelState.IsValid) { tblInstructorCourse tic = new tblInstructorCourse(); tic.Id = instructorCourseViewModel.Id; tic.CourseId = instructorCourseViewModel.CourseId; tic.InstructorId = instructorCourseViewModel.InstructorId; _instructorCourseRepository.MyAdd(tic); _instructorCourseRepository.MySave(); return(RedirectToAction("Index")); } ViewBag.CourseId = new SelectList(_courseRepository.GetAllCourses(), "Id", "CourseName", instructorCourseViewModel.CourseId); ViewBag.InstructorId = new SelectList(_instructorRepository.GetAllInstructors(), "Id", "InstructorName", instructorCourseViewModel.InstructorId); return(View(instructorCourseViewModel)); }
public tblInstructorCourse MyRemove(tblInstructorCourse obj) { _db.tblInstructorCourses.Remove(obj); return(obj); }
public tblInstructorCourse MyAdd(tblInstructorCourse obj) { _db.tblInstructorCourses.Add(obj); return(obj); }