コード例 #1
0
        public ActionResult AddCheckout(AddCheckoutViewModel viewModel)
        {
            PilotCheckout checkout = new PilotCheckout();
            checkout.AircraftId = viewModel.AircraftId;
            checkout.PilotId = viewModel.PilotId;
            checkout.InstructorId = viewModel.InstructorId;
            checkout.CheckoutDate = viewModel.CheckoutDate;

            _dataService.AddCheckout(checkout);

            return PilotReview(viewModel.PilotId);
        }
コード例 #2
0
        public ActionResult AddCheckout(int memberId, string memberName)
        {
            List<Aircraft> availableAircraft = _dataService.GetAircraftAvailableForCheckIn(memberId);
            ProfileCommon profile = ProfileCommon.GetProfile();
            string instructorName = profile.FirstName + " " + profile.LastName;
            AddCheckoutViewModel viewModel = new AddCheckoutViewModel();
            viewModel.PilotName = memberName;
            viewModel.InstructorId = profile.MemberId;
            viewModel.InstructorName = instructorName;
            viewModel.AircraftId = -1;
            viewModel.AircraftList = availableAircraft.Select(a =>
                new AircraftCheckoutInfoViewModel() 
                { 
                    Id = a.Id,
                    RegistrationNumber = a.RegistrationNumber,
                    CheckoutRequirements = a.CheckoutRequirements
                }).ToList();
            viewModel.PilotId = memberId;
            viewModel.CheckoutDate = DateTime.Now;

            return View(ViewNames.AddCheckout, viewModel);
        }