// GET: MovieSession
        public ActionResult Index(int movieId)
        {
            List <MovieSessionModel> sessions = new List <MovieSessionModel>();

            sessions = MovieSessionManager.GetSessions(movieId).Select(s => MovieSessionModel.FromData(s)).ToList();
            return(View(sessions));
        }
Esempio n. 2
0
        public ActionResult Buy(int id)
        {
            //seansa dati
            MovieSessionModel session = MovieSessionModel.FromData(MovieSessionManager.GetSession(id));
            var basket = Session.Get().Basket;

            basket.Add(session);

            return(RedirectToAction("Movie", new { id = session.MovieId }));
        }
Esempio n. 3
0
        public ActionResult Buy(int id)
        {
            //seansa dati
            MovieSessionModel session = MovieSessionModel.FromData(MovieSessionManager.Get(id));

            //nolasam lietotaja sessijas datus un papildinam grozu ar izveleto seansu
            var basket = Session.Get().Basket;

            basket.Add(session);
            return(RedirectToAction("movie", new { id = session.MovieId }));
        }
Esempio n. 4
0
        public ActionResult Movie(int id)
        {
            MovieReservationModel model = new MovieReservationModel();

            model.movie    = MovieModel.FromData(MovieManager.GetMovie(id)); // atlasa filmas datus pēc ID
            model.Sessions = MovieSessionManager.
                             GetSessions(id).Select(s => MovieSessionModel.FromData(s))
                             .ToList();// atlasa filmas seansus pēc ID
            // ielikt rezultātus modelī

            return(View(model));
        }
        public ActionResult Edit(int?id, int movieId)
        {
            MovieSessionModel session = null;

            if (id.HasValue)
            {
                session = MovieSessionModel.FromData(MovieSessionManager.GetSession(id.Value));
            }
            else
            {
                session         = new MovieSessionModel();
                session.MovieId = movieId;
            }
            return(View(session));
        }
Esempio n. 6
0
        public ActionResult Edit(int?id, int movieId)
        {
            MovieSessionModel model = null;

            if (!id.HasValue)
            {
                model = MovieSessionModel.FromData(MovieSessionManager.Get(id.Value));
            }
            else
            {
                model         = new MovieSessionModel();
                model.MovieId = movieId;
            }
            return(View(model));
        }
Esempio n. 7
0
        public ActionResult Edit(int?id) // šis bloks nepieciešams lietotāja datu attēlošanai . Jautājuma zīme norāda, ka id var būt tukšs
        {
            MovieModel movie = null;     // jādefinē kinoteātris, kas jālabo vai jāpievieno

            if (id.HasValue)             // ja ID ir definēts, tiek veikta rediģēšana
            {
                movie = MovieModel.FromData(MovieManager.GetMovie(id.Value));
                movie.MovieSessions = MovieSessionManager.GetSessions(id.Value).
                                      Select(s => MovieSessionModel.FromData(s)).ToList();
            }
            else
            {
                movie = new MovieModel(); // ja id nav definēts, tad kinoteātri neatlasam, pievienojam tukšu, lai nav problēmas ar Id lauku
            }
            return(View(movie));
        }
Esempio n. 8
0
        public ActionResult Movie(int id)
        {
            MovieReservationModel model = new MovieReservationModel();

            //1.Atlasit filmas datus pec ID
            model.Movie = MovieModel.FromData(MovieManager.GetMovie(id));

            //2.Atlasit filmas seansuns pec filmas ID
            model.Sessions = MovieSessionManager.GetSessions(id)
                             .Select(s => MovieSessionModel.FromData(s))
                             .ToList();

            //3.Ielikt rezultatus modeli

            //4.Realizet Movie.cshtml failu - attelot filmas datus un sarakstu ar seansiem

            return(View(model));
        }
Esempio n. 9
0
        public ActionResult Edit(int?id, int?cinemaId)
        {
            MovieModel movie = null;

            if (!id.HasValue)
            {
                movie = new MovieModel()
                {
                    CinemaId = cinemaId.Value,
                };
            }
            else
            {
                movie = MovieModel.FromData(MovieManager.GetMovie(id.Value));
                movie.MovieSessions = MovieSessionManager.GetSessions(id.Value)
                                      .Select(s => MovieSessionModel.FromData(s))
                                      .ToList();
            }
            return(View(movie));
        }