public ActionResult DeleteConfirmed(int id) { tblInstructor it = _instuctorRepository.GetInstructorById(id); _instuctorRepository.MyRemove(it); _instuctorRepository.MySave(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,InstructorName,InstructorContact")] InstructorViewModel instructorVM) { if (ModelState.IsValid) { tblInstructor it = new tblInstructor(); it.Id = instructorVM.Id; it.InstructorName = instructorVM.InstructorName; it.InstructorContact = instructorVM.InstructorContact; //db.Entry(it).State = EntityState.Modified; _instuctorRepository.MySave(); return(RedirectToAction("Index")); } return(View(instructorVM)); }
public ActionResult Create([Bind(Include = "Id,InstructorName,InstructorContact")] InstructorViewModel InstructorVM) { if (ModelState.IsValid) { tblInstructor it = new tblInstructor(); it.Id = InstructorVM.Id; it.InstructorName = InstructorVM.InstructorName; it.InstructorContact = InstructorVM.InstructorContact; _instuctorRepository.MyAdd(it); _instuctorRepository.MySave(); return(RedirectToAction("Index")); } return(View(InstructorVM)); }
public tblInstructor MyRemove(tblInstructor obj) { _db.tblInstructors.Remove(obj); return(obj); }
public tblInstructor MyAdd(tblInstructor obj) { _db.tblInstructors.Add(obj); return(obj); }