Example #1
0
        public void DeleteSpeaker(int speakerId)
        {
            var deletedSpeaker = (from s in _speakerRepo.GetById(speakerId)
                                  select s).FirstOrDefault();

            var relatedSlots = (from s in _slotRepo.List(deletedSpeaker.ConferenceId)
                                where s.SpeakerId == deletedSpeaker.Id
                                select s).ToList();

            _slotRepo.DeleteRelatedSlots(relatedSlots);
            _speakerRepo.Delete(deletedSpeaker);
            _speakerRepo.SaveChanges();
        }
Example #2
0
        //public void DeleteRoom(int roomId)
        //{
        //    _slotRepo.DeleteSlotsRoomRelated(roomId);
        //    _roomRepo.Delete(roomId);
        //}

        public void DeleteRoom(int roomId)
        {
            var deletedRoom = (from r in _roomRepo.GetById(roomId)
                               select r).FirstOrDefault();

            var relatedSlots = (from s in _slotRepo.List(deletedRoom.ConferenceId)
                                where s.RoomId == deletedRoom.Id
                                select s).ToList();

            _slotRepo.DeleteRelatedSlots(relatedSlots);
            _roomRepo.Delete(deletedRoom);
            _roomRepo.SaveChanges();
        }
        //this method has been refactored 6/5/16
        public void DeletePresentation(int presentationId)
        {
            var deletedPresentation = (from p in _presentRepo.GetById(presentationId)
                                       select p).FirstOrDefault();

            var relatedSlots = (from s in _slotRepo.List(deletedPresentation.ConferenceId)
                                where s.PresentationId == deletedPresentation.Id
                                select s).ToList();

            _slotRepo.DeleteRelatedSlots(relatedSlots);

            _presentRepo.Delete(deletedPresentation);
            _presentRepo.SaveChanges();
        }