Exemple #1
0
        public CrewDetails GetDetails(int id)
        {
            var crew         = GetById(id);
            var pilot        = _pilotService.GetById(crew.PilotId);
            var airhostesses = _airhostessService.GetByCrewId(id);

            return(CrewDetails.Create(crew, pilot, airhostesses));
        }
Exemple #2
0
        public CrewDetails GetDetails(int id)
        {
            var crew = _unitOfWork.Set <Crew>()
                       .Details(x => x.Id == id).FirstOrDefault();

            if (crew == null)
            {
                throw new NotFoundException("Crew with such id was not found");
            }
            return(CrewDetails.Create(crew));
        }
Exemple #3
0
        public IList <CrewDetails> GetAllDetails()
        {
            var crews        = GetAll();
            var pilots       = _pilotService.GetAll();
            var airhostesses = _airhostessService.GetAll();

            var joined = from crew in crews
                         join pilot in pilots on crew.PilotId equals pilot.Id
                         join airhostess in airhostesses
                         on crew.Id equals airhostess.CrewId into crewAirhostesses
                         select CrewDetails.Create(crew, pilot, crewAirhostesses);

            return(joined.ToList());
        }