コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            EventsRSVP eventsRSVP = db.EventsRSVPs.Find(id);

            db.EventsRSVPs.Remove(eventsRSVP);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public ActionResult Edit([Bind(Include = "Id,EventId,UserId,HasPaid,Status")] EventsRSVP eventsRSVP)
        {
            if (ModelState.IsValid)
            {
                db.Entry(eventsRSVP).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index", "Events"));
            }

            //ViewBag.UserId = new SelectList(db.AspNetUsers, "Id", "Email", eventsRSVP.UserId);
            // ViewBag.EventId = new SelectList(db.Events, "Id", "Location", eventsRSVP.EventId);
            return(View(eventsRSVP));
        }
コード例 #3
0
        // GET: EventsRSVPs/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EventsRSVP eventsRSVP = db.EventsRSVPs.Find(id);

            if (eventsRSVP == null)
            {
                return(HttpNotFound());
            }
            return(View(eventsRSVP));
        }
コード例 #4
0
        public ActionResult Create(EventsRSVP eventsRSVP)
        {
            //Get and set the user's id
            eventsRSVP.UserId = User.Identity.GetUserId();

            //Set HasPaid to False (for now, must implement this logic later)
            eventsRSVP.HasPaid = false;

            if (ModelState.IsValid)
            {
                db.EventsRSVPs.Add(eventsRSVP);
                db.SaveChanges();
                return(RedirectToAction("Index", "Events"));
            }

            return(RedirectToAction("Index", "Home"));
        }
コード例 #5
0
        // GET: EventsRSVPs/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            EventsRSVP eventsRSVP = db.EventsRSVPs.Find(id);

            if (eventsRSVP == null)
            {
                return(HttpNotFound());
            }

            //Setup ViewBag to send user and event info to the Edit View
            Event thisEvent = db.Events.Find(eventsRSVP.EventId);

            ViewBag.thisEventTitle = thisEvent.Title;
            ViewBag.thisEventId    = thisEvent.Id;

            return(View(eventsRSVP));
        }