public ActionResult Delete(int id) { HotelRepositoryDB rep = new HotelRepositoryDB(); rep.Delete(id); return(Index()); }
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 }
public ActionResult Create() { HotelRepositoryDB rep = new HotelRepositoryDB(); Hotel h = new Hotel(0, "neues Hotel", 0); rep.Save(h); return(RedirectToAction("Index", "Hotel")); }
public ActionResult Edit(int id) { var rep = new HotelRepositoryDB(); var hotel = rep.FindById(id); ViewBag.StarSelection = CreateStars(); return(View(hotel)); }
// GET: Hotel public ActionResult Index() { HotelRepositoryDB rep = new HotelRepositoryDB(); List <Hotel> hotels = rep.FindAll(); //return View(hotels); return(View("Index", hotels)); }
public ActionResult Edit(Hotel h) { HotelRepositoryDB rep = new HotelRepositoryDB(); rep.Save(h); ViewBag.Message = "Hotel gespeichert"; ViewBag.StarSelection = CreateStars(); return(View(h)); }