Exemple #1
0
        public static Timeslot Map(this Data.Timeslot t)
        {
            Timeslot timeslot = new Timeslot()
            {
                ID        = t.ID,
                EventID   = t.Event_ID,
                Name      = t.Name,
                StartTime = t.StartTime ?? DateTime.MinValue, // why am I doing this?
                EndTime   = t.EndTime ?? DateTime.MinValue
            };

            return(timeslot);
        }
Exemple #2
0
        public void CreateTimeslot(Timeslot timeslot)
        {
            using (OCCDB db = new OCCDB())
            {
                Data.Timeslot t = new Data.Timeslot()
                {
                    Event_ID  = timeslot.EventID,
                    Name      = timeslot.Name,
                    StartTime = timeslot.StartTime,
                    EndTime   = timeslot.EndTime
                };

                db.Timeslots.Add(t);

                db.SaveChanges();
            }
        }
Exemple #3
0
        public void DeleteTimeslot(int id)
        {
            using (OCCDB db = new OCCDB())
            {
                Data.Timeslot Timeslot = (from t in db.Timeslots.Include("Sessions")
                                          where t.ID == id
                                          select t).FirstOrDefault();

                if (Timeslot.Sessions.Count > 0)
                {
                    throw new Exception("Can't delete a Timeslot that contains sessions!");
                }

                db.Timeslots.Remove(Timeslot);

                db.SaveChanges();
            }
        }
        public void CreateTimeslot(Timeslot timeslot)
        {
            using (OCCDB db = new OCCDB())
            {
                Data.Timeslot t = new Data.Timeslot()
                {
                    Event_ID = timeslot.EventID,
                    Name = timeslot.Name,
                    StartTime = timeslot.StartTime,
                    EndTime = timeslot.EndTime
                };

                db.Timeslots.Add(t);

                db.SaveChanges();
            }
        }