예제 #1
0
        public void CreateEvent(Event event_)
        {
            using (var db = new CC.Data.CCDB())
            {
                if (event_.IsDefault)
                {
                    var defaultEvent = db.Events.Where(x => x.IsDefault).FirstOrDefault();
                    if (defaultEvent != null)
                        defaultEvent.IsDefault = false;
                }

                Data.Event e = new Data.Event();

                e.Name = event_.Name;
                e.Description = event_.Description;
                e.TwitterHashTag = event_.TwitterHashTag;
                e.StartTime = event_.StartTime;
                e.EndTime = event_.EndTime;
                e.Location = event_.Location;
                e.Address1 = event_.Address1;
                e.Address2 = event_.Address2;
                e.City = event_.City;
                e.State = event_.State;
                e.Zip = event_.Zip;
                e.IsDefault = event_.IsDefault;
                e.IsSponsorRegistrationOpen = event_.IsSponsorRegistrationOpen;
                e.IsSpeakerRegistrationOpen = event_.IsSpeakerRegistrationOpen;
                e.IsAttendeeRegistrationOpen = event_.IsAttendeeRegistrationOpen;
                e.IsVolunteerRegistrationOpen = event_.IsVolunteerRegistrationOpen;

                db.Events.Add(e);
                db.SaveChanges();
            }
        }
예제 #2
0
        public static Event Map(this Data.Event e)
        {
            Event result = new Event()
            {
                ID = e.ID,
                Name = e.Name,
                Description = e.Description,
                TwitterHashTag = e.TwitterHashTag,
                StartTime = e.StartTime,
                EndTime = e.EndTime,
                Location = e.Location,
                Address1 = e.Address1,
                Address2 = e.Address2,
                City = e.City,
                State = e.State,
                Zip = e.Zip,
                IsDefault = e.IsDefault,
                IsSponsorRegistrationOpen = e.IsSponsorRegistrationOpen,
                IsSpeakerRegistrationOpen = e.IsSpeakerRegistrationOpen,
                IsAttendeeRegistrationOpen = e.IsAttendeeRegistrationOpen,
                IsVolunteerRegistrationOpen = e.IsVolunteerRegistrationOpen
            };

            return result;
        }