Пример #1
0
        public ActionResult InstructorDetails(int memberId)
        {
            InstructorData instructor = _dataService.GetInstructorInfoByMemberId(memberId);
            Member member = _dataService.GetMember(memberId);

            InstructorViewModel instructorVM = new InstructorViewModel()
            {
                MemberId = instructor.MemberId,
                AltPhone = member.Phone,
                AvailableForCheckoutsAnnuals = instructor.AvailableForCheckoutsAnnuals,
                InstructOnWeekdayNights = instructor.InstructOnWeekdayNights,
                InstructOnWeekdays = instructor.InstructOnWeekdays,
                InstructOnWeekends = instructor.InstructOnWeekends,
                CeritifcateNumber = instructor.CertificateNumber,
                Comments = instructor.Comments,
                DesignatedForStageChecks = instructor.DesignatedForStageChecks,
                Email = member.Login.Email,
                FullName = member.FullName,
                Id = instructor.Id,
                Phone = member.Phone,
                Ratings = instructor.Ratings
            };

            if (instructor.AuthorizedAircraft != null)
            {
                instructorVM.AuthorizedAircraft = new List<AircraftListItemViewModel>();

                foreach (var ac in instructor.AuthorizedAircraft)
                {
                    AircraftListItemViewModel avm = new AircraftListItemViewModel
                    {
                        Id = ac.AircraftId,
                        RegistrationNumber = ac.Aircraft.RegistrationNumber
                    };
                    instructorVM.AuthorizedAircraft.Add(avm);
                }
            }

            return View(ViewNames.InstructorDetails, instructorVM);
        }
Пример #2
0
        public ActionResult OwnerHome(int memberId)
        {
            List<Aircraft> aircraftList = _dataService.GetManagedAircraftForMember(memberId);

            AircraftOwnerHomeViewModel pageVM = new AircraftOwnerHomeViewModel();
            pageVM.MemberId = memberId;

            foreach (var ac in aircraftList)
            {
                AircraftListItemViewModel acVM = new AircraftListItemViewModel()
                {
                    Id = ac.Id,
                    ImageUrl = "",
                    Make = ac.Make,
                    Model = ac.Model,
                    RegistrationNumber = ac.RegistrationNumber
                };

                pageVM.Aircraft.Add(acVM);
            }

            return View("OwnerHome", pageVM);
        }
Пример #3
0
        private List<AircraftListItemViewModel> GetAircraftList()
        {
            List<AircraftListItemViewModel> avmList = new List<AircraftListItemViewModel>();
            List<Aircraft> aircraft = _dataService.GetAllAirplanes();

            foreach (var a in aircraft)
            {
                AircraftListItemViewModel avm = new AircraftListItemViewModel();
                avm.Id = a.Id;
                avm.RegistrationNumber = a.RegistrationNumber;
                avmList.Add(avm);
            }
            return avmList;
        }
Пример #4
0
        public ActionResult GetRates()
        {
            List<Aircraft> aircraft = _dataService.GetAllAirplanes();
            List<AircraftListItemViewModel> vmList = new List<AircraftListItemViewModel>();
            foreach (var ac in aircraft)
            {
                AircraftListItemViewModel vm = new AircraftListItemViewModel()
                {
                    RegistrationNumber = ac.RegistrationNumber,
                    HourlyRate = ac.HourlyRate.ToString(),
                    Make = ac.Make,
                    Model = ac.Model,
                    CheckoutRequirements = ac.CheckoutRequirements
                };

                if (ac.Images.Count > 0)
                {
                    AircraftImage img = ac.Images.FirstOrDefault(im => im.Type == AircraftImageTypes.ExteriorMain.ToString());
                    if (img != null)
                        vm.ImageUrl = Url.Content(ConfigurationManager.AppSettings["AircraftImages"] + "/" + img.FileName_Small);
                }

                vmList.Add(vm);
            }

            return View(ViewNames.AircraftRates, vmList);
        }