// GET: Bookings/Details/5 public async Task<IActionResult> Details(int? id) { if (id == null) { return NotFound(); } var booking = await _context.Booking .SingleOrDefaultAsync(m => m.Id == id); //Pass information over so it can be sent to database and used in other categories BookingSystemDTO bookingsystemdto = new BookingSystemDTO(); myBooking myShows = new myBooking(); DatabaseManager.BookingId = booking.Id; myShows.PerformanceId = booking.PerformanceId; myShows.Name = booking.Name; myShows.Email = booking.Email; myShows.NumberFullPrice = booking.NumberFullPrice; myShows.NumberConcessionPrice = booking.NumberConcessionPrice; myShows.StoreEmail = booking.StoreEmail; myShows.TotalCost = (booking.NumberFullPrice * 30) + (booking.NumberConcessionPrice * 25); DatabaseManager.NumberOfSeats = booking.NumberFullPrice + booking.NumberConcessionPrice; //DatabaseManager.BookingId = (int)id; var allbookings = _context.Booking.ToList(); bookingsystemdto.bookings = allbookings; bookingsystemdto.myBooking = myShows; if (booking == null) { return NotFound(); } return View(bookingsystemdto); }
public async Task<IActionResult> Create([Bind("Id,PerformanceId,Name,Email,NumberFullPrice,NumberConcessionPrice,StoreEmail,TotalCost")] Booking booking) { BookingSystemDTO bookingsystemdto = new BookingSystemDTO(); myBooking myShows = new myBooking(); if (ModelState.IsValid) { _context.Add(booking); await _context.SaveChangesAsync(); return RedirectToAction("Details", new {booking.Id }); } return View(booking); }