Example #1
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 }));
            }
        }
Example #2
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 }));
            }
        }
Example #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 }));
            }
        }
Example #4
0
        public void LoadTest()
        {
            List <Format> formats = new List <Format>();

            formats = FormatManager.Load();
            int expected = 3;

            Assert.AreEqual(expected, formats.Count);
        }
Example #5
0
        // GET: Format

        #region "Pre-WebAPI"
        public ActionResult Index()
        {
            if (Authenticate.IsAuthenticated())
            {
                formats = FormatManager.Load();
                return(View(formats));
            }
            else
            {
                return(RedirectToAction("Login", "User", new { returnurl = HttpContext.Request.Url }));
            }
        }
Example #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack) //is it the first time here
            {
                items = FormatManager.Load();
                Rebind();
                Session["items"] = items;
                ddlExisting_SelectedIndexChanged(sender, e);

                //Put ratings in session so i can use them later
            }
            else
            {
                items = (List <Format>)Session["items"];
            }
        }
Example #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 }));
            }
        }
Example #8
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 }));
            }
        }
Example #9
0
        public void LoadTest()
        {
            List <Format> formats = FormatManager.Load();

            Assert.AreEqual(3, formats.Count);
        }
Example #10
0
        // GET: api/Format
        public IEnumerable <Format> Get()
        {
            List <Format> formats = FormatManager.Load();

            return(formats);
        }
Example #11
0
        // GET: api/Format
        public IEnumerable <Format> Get()
        {
            List <Format> programs = FormatManager.Load();

            return(programs);
        }
Example #12
0
        public void LoadTest()
        {
            List <Format> formats = FormatManager.Load();

            Assert.IsTrue(formats.Count > 0);
        }