// GET: Movie/Edit/5 public ActionResult Edit(int id) { if (Authenticate.IsAuthenticated()) { MovieGenresDirectorsRatingsFormats mgdrf = new MovieGenresDirectorsRatingsFormats(); mgdrf.Movie = MovieManager.LoadById(id); mgdrf.DirectorList = DirectorManager.Load(); mgdrf.RatingList = RatingManager.Load(); mgdrf.FormatList = FormatManager.Load(); mgdrf.Genres = GenreManager.Load(); // Load them all // Deal with the selected ones mgdrf.Movie.Genres = MovieManager.LoadGenres(id); mgdrf.GenreIds = mgdrf.Movie.Genres.Select(a => a.Id); // Select the ids // Put them into session Session["genreids"] = mgdrf.GenreIds; return(View(mgdrf)); } else { return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url })); } }
// GET: Movie/Edit/5 public ActionResult Edit(int id) { if (Authenticate.IsAuthenticated()) { ViewBag.Title = "Edit"; MovieGenresDirectorsRatingsFormats mgdrf = new MovieGenresDirectorsRatingsFormats(); mgdrf.Movie = MovieManager.LoadByID(id); mgdrf.Directors = DirectorManager.Load(); mgdrf.Genres = GenreManager.Load(); mgdrf.Ratings = RatingManager.Load(); mgdrf.Formats = FormatManager.Load(); IEnumerable <int> existingGenreIds = new List <int>(); mgdrf.Movie.Genres = MovieManager.LoadGenres(id); mgdrf.GenreIds = mgdrf.Movie.Genres.Select(a => a.Id); //put genres in session Session["genreids"] = mgdrf.GenreIds; return(View(mgdrf)); } else { return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url })); } }
// GET: Movie/Edit/5 public ActionResult Edit(int id) { if (Authenticate.IsAuthenticated()) { ViewBag.Title = "Edit"; MovieGenresDirectorsRatingsFormats mgdrf = new MovieGenresDirectorsRatingsFormats(); mgdrf.Movie = MovieManager.LoadById(id); mgdrf.RatingList = RatingManager.Load(); mgdrf.FormatList = FormatManager.Load(); mgdrf.GenreList = GenreManager.Load(); mgdrf.DirectorList = DirectorManager.Load(); mgdrf.Movie.Genres = MovieManager.LoadGenres(id); mgdrf.GenreIds = mgdrf.Movie.Genres.Select(g => g.Id); Session["genreids"] = mgdrf.GenreIds; return(View(mgdrf)); } else { return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url })); } }
public void LoadTest() { List <Rating> ratings = new List <Rating>(); ratings = RatingManager.Load(); int expected = 5; Assert.AreEqual(expected, ratings.Count); }
// GET: Rating public ActionResult Index() { if (Authenticate.IsAuthenticated()) { ratings = RatingManager.Load(); return(View(ratings)); } else { return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url })); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) //is it the first time here { items = RatingManager.Load(); Rebind(); Session["items"] = items; ddlRating_SelectedIndexChanged(sender, e); //Put ratings in session so i can use them later } else { items = (List <Rating>)Session["items"]; } }
// GET: Movie/Create public ActionResult Create() { if (Authenticate.IsAuthenticated()) { ViewBag.Title = "Create"; MovieGenresDirectorsRatingsFormats mgdrf = new MovieGenresDirectorsRatingsFormats(); mgdrf.Movie = new Movie(); mgdrf.Directors = DirectorManager.Load(); mgdrf.Genres = GenreManager.Load(); mgdrf.Ratings = RatingManager.Load(); mgdrf.Formats = FormatManager.Load(); return(View(mgdrf)); } else { return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url })); } }
protected void Page_Load(object sender, EventArgs e) { // If not postback, (here for the first time, load from database) if (!IsPostBack) { // Call the correct load method in the BL ratings = new List <Rating>(); ratings = RatingManager.Load(); Rebind(); // Put into session Session["ratings"] = ratings; } else { // Load from session ratings = (List <Rating>)Session["ratings"]; } }
// GET: Movie/Create public ActionResult Create() { if (Authenticate.IsAuthenticated()) { ViewBag.Title = "Create"; MovieGenresDirectorsRatingsFormats mdf = new MovieGenresDirectorsRatingsFormats(); mdf.Movie = new DVDCentral.BL.Models.Movie(); mdf.FormatList = FormatManager.Load(); mdf.RatingList = RatingManager.Load(); mdf.DirectorList = DirectorManager.Load(); mdf.GenreList = GenreManager.Load(); return(View(mdf)); } else { return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url })); } }
public void LoadTest() { List <Rating> ratings = RatingManager.Load(); Assert.AreEqual(4, ratings.Count); }
public void LoadTest() { List <Rating> ratings = RatingManager.Load(); Assert.IsTrue(ratings.Count > 0); }
// GET: api/Rating public IEnumerable <Rating> Get() { List <Rating> ratings = RatingManager.Load(); return(ratings); }