/// <summary> /// Create a new PersonEvent object. /// </summary> /// <param name="personEventId">Initial value of the PersonEventId property.</param> /// <param name="personId">Initial value of the PersonId property.</param> /// <param name="eventId">Initial value of the EventId property.</param> /// <param name="completed">Initial value of the Completed property.</param> public static PersonEvent CreatePersonEvent(global::System.Int32 personEventId, global::System.Int32 personId, global::System.Int32 eventId, global::System.Boolean completed) { PersonEvent personEvent = new PersonEvent(); personEvent.PersonEventId = personEventId; personEvent.PersonId = personId; personEvent.EventId = eventId; personEvent.Completed = completed; return personEvent; }
public void UpdatePersonEvent(int personId, int eventId, bool completed) { var personEvent = Context.PersonEvents.FirstOrDefault(p => p.PersonId == personId && p.EventId == eventId); if (personEvent == null) { personEvent = new PersonEvent {PersonId = personId, EventId = eventId}; Context.AddToPersonEvents(personEvent); } personEvent.Completed = completed; Context.SaveChanges(); }
/// <summary> /// Deprecated Method for adding a new object to the PersonEvents EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToPersonEvents(PersonEvent personEvent) { base.AddObject("PersonEvents", personEvent); }