Beispiel #1
0
        public ActionResult Create([Bind(Include = "Booking2ID,VenueID,Date,TotalNumberOfGuests,OccasionType")] Booking2 booking2, BookingStatus booking)
        {
            if (ModelState.IsValid)
            {
                if (booking.StageCheck(1, User.Identity.Name))
                {
                    ModelState.AddModelError("", @"You have already Completed this stage for your active booking.");
                    ViewBag.VenueID = new SelectList(db.Venues, "VenueID", "VenueName", booking2.VenueID);
                    return(View(booking2));
                }
                if (!booking2.getDate(booking2.Date))
                {
                    // booking2.Email = User.Identity.Name;
                    booking2.BookingStatusId = booking.getBookingStatusId(User.Identity.Name);
                    booking.editStage(User.Identity.Name, 1);
                    db.Booking2.Add(booking2);
                    db.SaveChanges();
                    return(RedirectToAction("Decor", "UserDecors"));
                }
                ModelState.AddModelError("", "Date is already taken.");
                ViewBag.VenueID = new SelectList(db.Venues, "VenueID", "VenueName", booking2.VenueID);
                return(View(booking2));
            }

            ViewBag.VenueID = new SelectList(db.Venues, "VenueID", "VenueName", booking2.VenueID);
            return(View(booking2));
        }
Beispiel #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Booking2 booking2 = db.Booking2.Find(id);

            db.Booking2.Remove(booking2);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #3
0
 public ActionResult Edit([Bind(Include = "Booking2ID,VenueID,Date,TotalNumberOfGuests,OccasionType")] Booking2 booking2)
 {
     if (ModelState.IsValid)
     {
         db.Entry(booking2).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.VenueID = new SelectList(db.Venues, "VenueID", "VenueName", booking2.VenueID);
     return(View(booking2));
 }
Beispiel #4
0
        // GET: Booking2/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Booking2 booking2 = db.Booking2.Find(id);

            if (booking2 == null)
            {
                return(HttpNotFound());
            }
            return(View(booking2));
        }
Beispiel #5
0
        // GET: Booking2/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Booking2 booking2 = db.Booking2.Find(id);

            if (booking2 == null)
            {
                return(HttpNotFound());
            }
            ViewBag.VenueID = new SelectList(db.Venues, "VenueID", "VenueName", booking2.VenueID);
            return(View(booking2));
        }