Exemplo n.º 1
0
        public ActionResult Index()
        {
            using (var session = NHibernateHelper.OpenSession())
            {
                var genericDao = new NHibernateDAOFactory(session).getCabinDAO();
                ViewBag.Message = "Cabins List";

                return(View("index", new Tuple <IEnumerable <Cabin>, Cabin>(
                                new List <Cabin>(genericDao.GetAll()), _EmptyCabin
                                )));
            }
        }
Exemplo n.º 2
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
                                )));
            }
        }