// GET: Course/Edit/5 public ActionResult Edit(long id) { IDataAccess <Course> dataAccess = new CourseEFDataAccess(); CourseHandler handler = new CourseHandler(dataAccess); CourseEditModel vm = handler.QueryById(id); return(View(vm)); }
public ActionResult Delete(long id) { IDataAccess <Course> dataAccess = new CourseEFDataAccess(); CourseHandler handler = new CourseHandler(dataAccess); handler.Delete(id); return(RedirectToAction("Index")); }
// GET: Course public ActionResult Index() { IDataAccess <Course> dataAccess = new CourseEFDataAccess(); CourseHandler handler = new CourseHandler(dataAccess); List <CourseViewModel> models = handler.List(); return(View(models)); }
public ActionResult Edit(CourseEditModel vm) { try { IDataAccess <Course> dataAccess = new CourseEFDataAccess(); CourseHandler handler = new CourseHandler(dataAccess); handler.Update(vm); return(RedirectToAction("Index")); } catch { return(View()); } }