예제 #1
0
 public ActionResult Delete(int id)
 {
     using (var session = NHibernateHelper.OpenSession())
     {
         var genericDao = new NHibernateDAOFactory(session).getCabinDAO();
         genericDao.Delete(genericDao.GetById(id));
     }
     return(RedirectToAction("Index"));
 }
예제 #2
0
 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 }));
 }
예제 #3
0
        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
                                )));
            }
        }