Inheritance: System.Data.Objects.DataClasses.EntityObject
 /// <summary>
 /// Deprecated Method for adding a new object to the UserEvents EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUserEvents(UserEvent userEvent)
 {
     base.AddObject("UserEvents", userEvent);
 }
示例#2
0
 private static void SaveParticipants(string name)
 {
     var selectedEvent = repository.Events.Where(x => x.Name.Equals(name)).FirstOrDefault();
     if (selectedEvent != null)
     {
         var numberOfUsers = repository.Users.Count();
         var numberOfParticipants = random.Next(1, numberOfUsers);
         var users = repository.Users.ToList();
         for (int i = 0; i < numberOfParticipants; i++)
         {
             int index = random.Next(0, users.Count());
             var useremail = users.ElementAt(index).Email;
             users.RemoveAt(index);
             var participant = new UserEvent
             {
                 EventId = selectedEvent.EventId,
                 UserEmail = useremail,
                 NumberOfSpots = random.Next(1, selectedEvent.AvailableSpots)
             };
             repository.AddToUserEvents(participant);
         }
     }
 }
 /// <summary>
 /// Create a new UserEvent object.
 /// </summary>
 /// <param name="userEmail">Initial value of the UserEmail property.</param>
 /// <param name="eventId">Initial value of the EventId property.</param>
 /// <param name="numberOfSpots">Initial value of the NumberOfSpots property.</param>
 public static UserEvent CreateUserEvent(global::System.String userEmail, global::System.Int32 eventId, global::System.Int32 numberOfSpots)
 {
     UserEvent userEvent = new UserEvent();
     userEvent.UserEmail = userEmail;
     userEvent.EventId = eventId;
     userEvent.NumberOfSpots = numberOfSpots;
     return userEvent;
 }