public async Task <IActionResult> Edit(int id, [Bind("SessionId,BookedSeats,CineplexId,MovieId,MovieTime")] SessionTimes sessionTimes)
        {
            if (id != sessionTimes.SessionId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sessionTimes);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SessionTimesExists(sessionTimes.SessionId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            ViewData["CineplexId"] = new SelectList(_context.Cineplex, "CineplexId", "Cdescription", sessionTimes.CineplexId);
            ViewData["MovieId"]    = new SelectList(_context.Movie, "MovieId", "Mdescription", sessionTimes.MovieId);
            return(View(sessionTimes));
        }
        public async Task <IActionResult> Edit(int id, [Bind("CineplexId,Cdescription,ImageUrl,Location")] Cineplex cineplex)
        {
            if (id != cineplex.CineplexId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(cineplex);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CineplexExists(cineplex.CineplexId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(cineplex));
        }
示例#3
0
        public async Task <IActionResult> Edit(int id, [Bind("MovieId,ImageUrl,Mdescription,Price,Title")] Movie movie)
        {
            if (id != movie.MovieId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(movie);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!MovieExists(movie.MovieId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(movie));
        }