예제 #1
0
        public void UpdateTimeslot(Timeslot timeslot)
        {
            //ToDo: Add error handling here. Brian Hall had an unhandled exception when he tried to submit a timeslot that was a past date-time.
            using (var db = new CC.Data.CCDB())
            {
                var t = db.Timeslots.Find(timeslot.ID);

                t.Name = timeslot.Name;
                t.StartTime = timeslot.StartTime;
                t.EndTime = timeslot.EndTime;

                db.SaveChanges();
            }
        }
예제 #2
0
        public void CreateTimeslot(Timeslot timeslot)
        {
            using (var db = new CC.Data.CCDB())
            {
                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();
            }
        }
예제 #3
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;
        }