public async Task <IActionResult> Edit(int id, [Bind("Id,Title")] Film film)
        {
            if (id != film.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(film);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FilmExists(film.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(film));
        }
예제 #2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Nr,Rows,Columns")] Hall hall)
        {
            if (id != hall.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hall);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HallExists(hall.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hall));
        }
        public async Task <IActionResult> ConfirmReservation(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var reservation = await _context.Reservations.FirstOrDefaultAsync(x => x.Id == id);

            reservation.ConfirmationDate = DateTime.Now;
            reservation.IsConfirmed      = true;

            _context.Update(reservation);

            await _context.SaveChangesAsync();

            return(null);
        }