예제 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            tblInstructorCourse tblInstructorCourse = _instructorCourseRepository.GetInstructorCourseById(id);

            _instructorCourseRepository.MySave();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        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);
        }
예제 #3
0
        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));
        }
예제 #4
0
 public tblInstructorCourse MyRemove(tblInstructorCourse obj)
 {
     _db.tblInstructorCourses.Remove(obj);
     return(obj);
 }
예제 #5
0
 public tblInstructorCourse MyAdd(tblInstructorCourse obj)
 {
     _db.tblInstructorCourses.Add(obj);
     return(obj);
 }