Example #1
0
        // GET: MovieSession
        public ActionResult Index(int movieId)
        {
            List <MoviesSessionModel> sessions = new List <MoviesSessionModel>();

            sessions = MovieSessionManager.GetSessions(movieId).Select(s => MoviesSessionModel.FromData(s)).ToList();
            return(View(sessions));
        }
        public ActionResult Buy(int id)
        {
            // seansa dati

            MoviesSessionModel session = MoviesSessionModel.FromData(MovieSessionManager.Get(id));

            // nolasām lietotaja sesijas datus un papildiām grozu ar izvēlēto seansu

            var basket = Session.Get().Basket;

            basket.Add(session);

            return(RedirectToAction("Movie", new { id = session.MovieId }));
        }
Example #3
0
 public ActionResult Edit(MoviesSessionModel model)
 {
     if (ModelState.IsValid)
     {
         if (model.Id != 0)
         {
             MovieSessionManager.Update(model.ToData());
         }
         else
         {
             MovieSessionManager.Create(model.ToData());
         }
     }
     return(RedirectToAction("Edit", "Session", new { id = model.MovieId }));
 }
Example #4
0
        public ActionResult Edit(int?id, int movieId)
        {
            MoviesSessionModel session = null;

            if (id.HasValue)
            {
                session = MoviesSessionModel.FromData(MovieSessionManager.Get(id.Value));
            }
            else
            {
                session         = new MoviesSessionModel();
                session.MovieId = movieId;
            }
            return(View(session));
        }
        public ActionResult Movie(int id)
        {
            MovieReservationModel model = new MovieReservationModel();

            //1. Atlasīt filmas datus pēc Id

            model.Movie = MovieModel.FromData(MovieManager.GetMovie(id));


            //2. Atlasīt filmas seansu pēc filmas ID

            model.Sessions = MovieSessionManager.GetSessions(id).Select(s => MoviesSessionModel.FromData(s)).ToList();
            //3. Ielikt rezultātus modeli
            //4. Realizēt MOvie.cshtml failu - attēlot filmas datus un datus un sarakstu ar seansiem

            return(View(model));
        }