public ActionResult Create(Student student) { try { StudentGateway studentGateway=new StudentGateway(); studentGateway.Insert(student); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Edit(Student student) { try { StudentGateway studentGateway=new StudentGateway(); studentGateway.Update(student); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Delete(Student student) { try { StudentGateway studentGateway=new StudentGateway(); studentGateway.Delete(student.Id); return RedirectToAction("Index"); } catch { return View(); } }
public ActionResult Delete(int id) { StudentGateway studentGateway=new StudentGateway(); Student student = studentGateway.GetAllStudents.Single(st => st.Id == id); return View(student); }
public ActionResult Index() { StudentGateway studentGateway = new StudentGateway(); List<StudentViewModel> studentViewModels = studentGateway.GetAll.ToList(); return View(studentViewModels); }