public ActionResult Create(BookingModel model) { TravelaEntities db = new TravelaEntities(); var customer = new CustomerT() { customerid = model.customerid, customername = model.customername, customersurname = model.customersurname, birthdate = model.birthdate, phone = model.phone, email = model.email, address = model.address }; var reservation = new ReservationT() { customerid = model.customerid, hotelid = model.hotelid, tourid = model.tourid, status = model.status = false, reservationnumber = model.reservationnumber = RandomGen2.Next() }; db.CustomerT.Add(customer); db.ReservationT.Add(reservation); db.SaveChanges(); return(Redirect("~/Web/Index")); }
public ActionResult DeleteConfirmed(int id) { ReservationT reservationT = db.ReservationT.Find(id); db.ReservationT.Remove(reservationT); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "reservationid,reservationnumber,customerid,tourid,status,hotelid")] ReservationT reservationT) { if (ModelState.IsValid) { db.Entry(reservationT).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.customerid = new SelectList(db.CustomerT, "customerid", "customername", reservationT.customerid); ViewBag.hotelid = new SelectList(db.HotelT, "hotelid", "hotelname", reservationT.hotelid); ViewBag.tourid = new SelectList(db.TourT, "tourid", "tourname", reservationT.tourid); return(View(reservationT)); }
// GET: ReservationTs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ReservationT reservationT = db.ReservationT.Find(id); if (reservationT == null) { return(HttpNotFound()); } return(View(reservationT)); }
// GET: ReservationTs/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ReservationT reservationT = db.ReservationT.Find(id); if (reservationT == null) { return(HttpNotFound()); } ViewBag.customerid = new SelectList(db.CustomerT, "customerid", "customername", reservationT.customerid); ViewBag.hotelid = new SelectList(db.HotelT, "hotelid", "hotelname", reservationT.hotelid); ViewBag.tourid = new SelectList(db.TourT, "tourid", "tourname", reservationT.tourid); return(View(reservationT)); }