public async Task <IActionResult> Create([Bind("Id,Name,Address,Phone")] Cinema cinema) { if (ModelState.IsValid) { _context.Add(cinema); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(cinema)); }
public async Task <IActionResult> Create([Bind("Id,Name")] Hall hall) { if (ModelState.IsValid) { _context.Add(hall); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(hall)); }
public async Task <IActionResult> Create([Bind("Id,price,Discount")] Ticket ticket) { if (ModelState.IsValid) { _context.Add(ticket); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ticket)); }
public async Task <IActionResult> Create([Bind("Id,Title,Release_date,Adult,Description,Origin,Poster_path")] Movie movie) { if (ModelState.IsValid) { _context.Add(movie); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(movie)); }
public async Task <IActionResult> Create([Bind("Id,Date,Language,Subtitles")] Performance performance) { if (ModelState.IsValid) { performance.Hall = _context.Halls.Where(S => S.Name.Equals("halltest")).FirstOrDefault(); performance.Movie = _context.Movies.Where(S => S.Title.Equals("batman")).FirstOrDefault(); _context.Add(performance); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(performance)); }
// GET: Seats public async Task <IActionResult> Index() { Performance performance = _context.Performances.Where(S => S.Movie.Id == 1).First(); for (int i = 0; i < 2; i++) { for (int j = 0; j < 2; j++) { Seat seat = new Seat(); seat.XPosition = i; seat.YPosition = j; seat.Performance = performance; _context.Add(seat); } } await _context.SaveChangesAsync(); return(View(await _context.Seats.ToListAsync())); }