Ejemplo n.º 1
0
        // 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 }));
            }
        }
Ejemplo n.º 2
0
        // 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 }));
            }
        }
Ejemplo n.º 3
0
        // 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 }));
            }
        }
Ejemplo n.º 4
0
        public void LoadTest()
        {
            List <Director> genres = new List <Director>();

            genres = DirectorManager.Load();
            int expected = 3;

            Assert.AreEqual(expected, genres.Count);
        }
Ejemplo n.º 5
0
 // GET: Director
 public ActionResult Index()
 {
     if (Authenticate.IsAuthenticated())
     {
         directors = DirectorManager.Load();
         return(View(directors));
     }
     else
     {
         return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url }));
     }
 }
Ejemplo n.º 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) //is it the first time here
            {
                items = DirectorManager.Load();
                Rebind();
                Session["items"] = items;
                ddlExisting_SelectedIndexChanged(sender, e);

                //Put ratings in session so i can use them later
            }
            else
            {
                items = (List <Director>)Session["items"];
            }
        }
Ejemplo n.º 7
0
        // 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 }));
            }
        }
Ejemplo n.º 8
0
        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
                directors = new List <Director>();
                directors = DirectorManager.Load();
                Rebind();

                // Put into session
                Session["directors"] = directors;
            }
            else
            {
                // Load from session
                directors = (List <Director>)Session["directors"];
            }
        }
Ejemplo n.º 9
0
        // 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 }));
            }
        }
Ejemplo n.º 10
0
        public void LoadTest()
        {
            List <Director> directors = DirectorManager.Load();

            Assert.IsTrue(directors.Count > 0);
        }
Ejemplo n.º 11
0
        public void LoadTest()
        {
            List <Director> directors = DirectorManager.Load();

            Assert.AreEqual(3, directors.Count);
        }