Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,MovieID,SalonID,Date")] Showing showing)
        {
            if (id != showing.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(showing);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ShowingExists(showing.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["MovieID"] = new SelectList(_context.Movies, "ID", "ID", showing.MovieID);
            ViewData["SalonID"] = new SelectList(_context.Salons, "ID", "ID", showing.SalonID);
            return(View(showing));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,MaxSeats")] Salon salon)
        {
            if (id != salon.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(salon);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SalonExists(salon.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(salon));
        }