Exemple #1
0
        public void DeleteSession(int id)
        {
            Data.Session session = (from s in _dbContext.Sessions.Include("Attendees") where s.ID == id select s).FirstOrDefault();

            if (session.Attendees.Count > 0)
            {
                throw new Exception("Can't delete a session that contains attendees!");
            }

            _dbContext.Sessions.Remove(session);

            _dbContext.SaveChanges();
        }
Exemple #2
0
        public void CreateSession(Session session)
        {
            Data.Session s = new Data.Session()
            {
                Event_ID    = session.EventID,
                Speaker_ID  = session.SpeakerID,
                Name        = session.Name,
                Description = session.Description,
                Level       = session.Level,
                Location    = session.Location,
                Status      = session.Status,
                Tag_ID      = session.TagID.Value
            };

            _dbContext.Sessions.Add(s);
            _dbContext.SaveChanges();
        }
        public void CreateSession(Session session)
        {
            Data.Session s = new Data.Session()
            {
                Event_ID = session.EventID,
                Speaker_ID = session.SpeakerID,
                Name = session.Name,
                Description = session.Description,
                Level = session.Level,
                Location = session.Location,
                Status = session.Status,
                Tag_ID = session.TagID.Value
            };

            _dbContext.Sessions.Add(s);
            _dbContext.SaveChanges();
        }