// GET: Admin/Reservation public ActionResult Index() { // Create a Repository object and save it to a session variable // if it doesn’t already exists as a session variabel if (Session["repository"] == null) { repository = new Repository(); Session["repository"] = repository; } // Read it from the session if already exists as a session variable else { repository = (Repository)Session["repository"]; } // returning the locally created object of repository return View(repository); }
public ActionResult _ResidentPets() { //declaring variable repository of type repository Repository repository = new Repository(); // Create a Repository object and save it to a session variable // if it doesn’t already exists as a session variabel if (Session["repository"] == null) { repository = new Repository(); Session["repository"] = repository; } // Read it from the session if already exists as a session variable else { repository = (Repository)Session["repository"]; } //Create a partiel view, notice this is located in the Shared folder //so therefore the convention is to use _ in front of the view name return PartialView("_ResidentPets",repository); }