示例#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();
        }
示例#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();
        }
示例#4
0
        // Get all slots for a specific conference
        public IList <SlotDTO> GetSlotList(int conferenceId)
        {
            var slots = (from s in _slotRepo.List(conferenceId)
                         select new SlotDTO
            {
                Id = s.Id,
                StartTime = s.StartTime,
                EndTime = s.EndTime,
                Room = new RoomDTO()
                {
                    Id = s.Room.Id,
                    Name = s.Room.Name,
                    ConferenceId = s.Room.ConferenceId
                },
                Presentation = new PresentationDTO()
                {
                    Title = s.Presentation.Title,
                    Description = s.Presentation.Description
                },
                Speaker = new SpeakerDTO()
                {
                    FirstName = s.Speaker.FirstName,
                    LastName = s.Speaker.LastName,
                    Title = s.Speaker.Title,
                    Phone = s.Speaker.Phone,
                    Email = s.Speaker.Email,
                    Company = s.Speaker.Company,
                    CoStreet = "",
                    CoCity = "",
                    CoState = "",
                    CoZip = "",
                    Bio = s.Speaker.Bio,
                    ImageUrl = s.Speaker.ImageUrl
                }
            }).ToList();

            return(slots);
        }