public ActionResult DeleteConfirmed(int id) { EventsRSVP eventsRSVP = db.EventsRSVPs.Find(id); db.EventsRSVPs.Remove(eventsRSVP); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
// 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)); }
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")); }
// 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)); }