public ActionResult Delete(int id) { using (var session = NHibernateHelper.OpenSession()) { var genericDao = new NHibernateDAOFactory(session).getCabinDAO(); genericDao.Delete(genericDao.GetById(id)); } return(RedirectToAction("Index")); }
public ActionResult Delete(int cabinId, int id) { using (var session = NHibernateHelper.OpenSession()) { var genericDao = new NHibernateDAOFactory(session).getPassengerDAO(); genericDao.Delete(genericDao.GetById(id)); } return(RedirectToAction("GetByCabin", new { cabinId })); }
public ActionResult Edit(int id) { using (var session = NHibernateHelper.OpenSession()) { var genericDao = new NHibernateDAOFactory(session).getCabinDAO(); var cabin = genericDao.GetById(id); ViewBag.Message = "Editing cabin: " + cabin.CabinName; return(View("index", new Tuple <IEnumerable <Cabin>, Cabin>( new List <Cabin>(genericDao.GetAll()), cabin ))); } }