Esempio n. 1
0
        public ActionResult Delete(int id)
        {
            HotelRepositoryDB rep = new HotelRepositoryDB();

            rep.Delete(id);
            return(Index());
        }
Esempio n. 2
0
        public ActionResult Details(int id)
        {
            HotelRepositoryDB rep = new HotelRepositoryDB();
            Hotel             h   = rep.FindById(id);

            return(View(h));     //ruft die View mit dem Namen der Actionmethode auf und übergibt den Parameter.
                                 //return View("Details", h);   //dieser Aufruf würde dasselbe liefern wie die Zeile davor
        }
Esempio n. 3
0
        public ActionResult Create()
        {
            HotelRepositoryDB rep = new HotelRepositoryDB();
            Hotel             h   = new Hotel(0, "neues Hotel", 0);

            rep.Save(h);
            return(RedirectToAction("Index", "Hotel"));
        }
Esempio n. 4
0
        public ActionResult Edit(int id)
        {
            var rep   = new HotelRepositoryDB();
            var hotel = rep.FindById(id);

            ViewBag.StarSelection = CreateStars();
            return(View(hotel));
        }
Esempio n. 5
0
        // GET: Hotel
        public ActionResult Index()
        {
            HotelRepositoryDB rep    = new HotelRepositoryDB();
            List <Hotel>      hotels = rep.FindAll();

            //return View(hotels);
            return(View("Index", hotels));
        }
Esempio n. 6
0
        public ActionResult Edit(Hotel h)
        {
            HotelRepositoryDB rep = new HotelRepositoryDB();

            rep.Save(h);
            ViewBag.Message       = "Hotel gespeichert";
            ViewBag.StarSelection = CreateStars();
            return(View(h));
        }