public ActionResult DeleteConfirmed(long id)
        {
            DependentPassHolder dependentPassHolder = db.DependentPassHolders.Find(id);

            db.DependentPassHolders.Remove(dependentPassHolder);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "DepID,FirstName,LastName,MiddleName,TicketNumber,SPH_ID")] DependentPassHolder dependentPassHolder)
 {
     if (ModelState.IsValid)
     {
         db.Entry(dependentPassHolder).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.SPH_ID       = new SelectList(db.SeasonPassHolders, "SPH_ID", "StreetAddress", dependentPassHolder.SPH_ID);
     ViewBag.TicketNumber = new SelectList(db.Tickets, "TicketNumber", "TicketNumber", dependentPassHolder.TicketNumber);
     return(View(dependentPassHolder));
 }
        // GET: DependentPassHolders/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DependentPassHolder dependentPassHolder = db.DependentPassHolders.Find(id);

            if (dependentPassHolder == null)
            {
                return(HttpNotFound());
            }
            return(View(dependentPassHolder));
        }
        // GET: DependentPassHolders/Edit/5
        public ActionResult Edit(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DependentPassHolder dependentPassHolder = db.DependentPassHolders.Find(id);

            if (dependentPassHolder == null)
            {
                return(HttpNotFound());
            }
            ViewBag.SPH_ID       = new SelectList(db.SeasonPassHolders, "SPH_ID", "StreetAddress", dependentPassHolder.SPH_ID);
            ViewBag.TicketNumber = new SelectList(db.Tickets, "TicketNumber", "TicketNumber", dependentPassHolder.TicketNumber);
            return(View(dependentPassHolder));
        }
        public ActionResult Create2([Bind(Include = "DepID,FirstName,LastName,MiddleName,TicketNumber,SPH_ID")] DependentPassHolder dependentPassHolder)
        {
            if (ModelState.IsValid)
            {
                var sphLogin = db.SPHLogins.First(x => x.LoginEmail == ApplicationSession.Username);
                var SPHId    = sphLogin.SPH_ID;
                dependentPassHolder.SPH_ID = SPHId;
                var ticket = new Ticket();
                ticket.Price               = (decimal)30.00;
                ticket.DateOfPurchase      = DateTime.Now.Date;
                ticket.TicketCode          = 5;
                dependentPassHolder.Ticket = ticket;

                db.DependentPassHolders.Add(dependentPassHolder);
                db.SaveChanges();
                return(RedirectToAction("DepQuestion2"));
            }

            ViewBag.SPH_ID       = new SelectList(db.SeasonPassHolders, "SPH_ID", "StreetAddress", dependentPassHolder.SPH_ID);
            ViewBag.TicketNumber = new SelectList(db.Tickets, "TicketNumber", "TicketNumber", dependentPassHolder.TicketNumber);
            return(View(dependentPassHolder));
        }