public bool insertRSVP(int userid, int eventid, string rsvp) { int n_userid = userid; int n_eventid = eventid; var selected_r = (from r in _db.rsvps where r.UserID == n_userid && r.EventID == n_eventid select r).FirstOrDefault(); try { if (selected_r == null) { rsvp new_r = new rsvp { UserID = n_userid, EventID = n_eventid, Rsvp1 = rsvp }; _db.rsvps.AddObject(new_r); } else { selected_r.Rsvp1 = rsvp; } _db.SaveChanges(); return true; } catch { return false; } }
/// <summary> /// Deprecated Method for adding a new object to the rsvps EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddTorsvps(rsvp rsvp) { base.AddObject("rsvps", rsvp); }
/// <summary> /// Create a new rsvp object. /// </summary> /// <param name="rsvpID">Initial value of the RsvpID property.</param> /// <param name="eventID">Initial value of the EventID property.</param> /// <param name="rsvp1">Initial value of the Rsvp1 property.</param> /// <param name="userID">Initial value of the UserID property.</param> public static rsvp Creatersvp(global::System.Int32 rsvpID, global::System.Int32 eventID, global::System.String rsvp1, global::System.Int32 userID) { rsvp rsvp = new rsvp(); rsvp.RsvpID = rsvpID; rsvp.EventID = eventID; rsvp.Rsvp1 = rsvp1; rsvp.UserID = userID; return rsvp; }