// GET: Buy Package public async Task <IActionResult> Buy(int?id) { if (id == null) { return(NotFound()); } Packages package = await _context.Packages .FirstOrDefaultAsync(m => m.PackageId == id); if (package == null) { return(NotFound()); } DateTime today = DateTime.Now.Date; string bookingNumber = "BBADED"; Bookings booking = new Bookings(); booking.PackageId = package.PackageId; booking.CustomerId = Convert.ToInt32(HttpContext.Session.GetString("userid")); booking.BookingDate = today; booking.TravelerCount = 1; booking.TripTypeId = "L"; booking.BookingNo = bookingNumber; _context.Add(booking); await _context.SaveChangesAsync(); return(RedirectToAction("Index", "Bookings")); }
public async Task <IActionResult> Create([Bind("BookingDetailId,ItineraryNo,TripStart,TripEnd,Description,Destination,BasePrice,AgencyCommission,BookingId,RegionId,ClassId,FeeId,ProductSupplierId")] BookingDetails bookingDetails) { if (ModelState.IsValid) { _context.Add(bookingDetails); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bookingDetails)); }
public async Task <IActionResult> Create([Bind("CustomerId,CustFirstName,CustLastName,CustAddress,CustCity,CustProv,CustPostal,CustCountry,CustHomePhone,CustBusPhone,CustEmail,AgentId,PasswordNotHashed,PasswordHashed,PasswordSalt")] Customers customers) { if (ModelState.IsValid) { _context.Add(customers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customers)); }
public async Task <IActionResult> Create([Bind("BookingId,BookingDate,BookingNo,TravelerCount,CustomerId,TripTypeId,PackageId")] Bookings bookings) { if (ModelState.IsValid) { _context.Add(bookings); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(bookings)); }
public async Task <IActionResult> Create([Bind("AgentId,AgtFirstName,AgtMiddleInitial,AgtLastName,AgtBusPhone,AgtEmail,AgtPosition,AgencyId")] Agents agents) { if (ModelState.IsValid) { _context.Add(agents); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(agents)); }
public async Task <IActionResult> Create([Bind("AgencyId,AgncyAddress,AgncyCity,AgncyProv,AgncyPostal,AgncyCountry,AgncyPhone,AgncyFax")] Agencies agencies) { if (ModelState.IsValid) { _context.Add(agencies); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(agencies)); }