Beispiel #1
0
        public static AttendingObject Create(EventObject eventObject, ProfileObject profileObject,
                                             string eventID, string userID)
        {
            var o = new AttendingDbRecord
            {
                EventID   = eventID,
                ProfileID = userID,
                Events    = eventObject?.DbRecord ?? new EventDbRecord(),
                Profiles  = profileObject?.DbRecord ?? new ProfileDbRecord()
            };

            o.EventID   = o.Events.ID;
            o.ProfileID = o.Profiles.ID;
            return(new AttendingObject(o));
        }
Beispiel #2
0
 public static void Initialize(EventProjectDbContext c)
 {
     c.Database.EnsureCreated();
     if (c.EventsProfiles.Any())
     {
         return;
     }
     foreach (var p in c.Profiles)
     {
         foreach (var e in c.Events)
         {
             var r = new AttendingDbRecord
             {
                 ProfileID = p.ID,
                 EventID   = e.ID
             };
             c.EventsProfiles.Add(r);
         }
     }
     c.SaveChanges();
 }