public ActionResult RemoveCheckout(int checkoutId) { PilotCheckout checkout = _dataService.GetCheckout(checkoutId); AircraftCheckoutViewModel viewModel = new AircraftCheckoutViewModel(); viewModel.Id = checkout.Id; viewModel.CheckoutDate = checkout.CheckoutDate; viewModel.AircraftId = checkout.AircraftId; viewModel.RegistrationNumber = checkout.Aircraft.RegistrationNumber; viewModel.PilotId = checkout.PilotId; viewModel.PilotName = checkout.Pilot.FullName; return(View(ViewNames.RemoveCheckout, viewModel)); }
private PilotReviewViewModel InitializePilotReviewViewModel(Member member) { PilotReviewViewModel pilotVM = new PilotReviewViewModel() { MemberId = member.Id, PilotName = member.FullName, AircraftCheckouts = new List <AircraftCheckoutViewModel>() }; pilotVM.FlightReview = new FlightReviewViewModel(); if (member.FlightReviews != null && member.FlightReviews.Count > 0) { FlightReview review = member.FlightReviews.OrderByDescending(r => r.Date).First(); pilotVM.FlightReview.ReviewDate = review.Date;//ToString("MMMM dd, yyyy"); pilotVM.FlightReview.InstructorName = review.InstructorName; pilotVM.FlightReview.Notes = review.InstructorNotes; pilotVM.FlightReview.RetractTime = review.RetractTime; pilotVM.FlightReview.TotalTime = review.TotalTime; pilotVM.FlightReview.ReviewType = review.ReviewType; //pilotVM.FlightReview.I = member.FlightReviews.First().Id; } foreach (var pilotCheckout in member.Checkouts) { AircraftCheckoutViewModel checkoutVM = new AircraftCheckoutViewModel(); checkoutVM.Id = pilotCheckout.Id; checkoutVM.AircraftId = pilotCheckout.AircraftId; Aircraft aircraft = _dataService.GetAircraftById(pilotCheckout.AircraftId); checkoutVM.RegistrationNumber = aircraft.RegistrationNumber; checkoutVM.CheckoutDate = pilotCheckout.CheckoutDate; checkoutVM.InstructorId = pilotCheckout.InstructorId; var instructor = _dataService.GetMember(pilotCheckout.InstructorId); checkoutVM.InstructorName = instructor.FullName; pilotVM.AircraftCheckouts.Add(checkoutVM); } if (member.StageChecks != null) { pilotVM.StageChecks = member.StageChecks.OrderBy(s => s.Date).ToList(); } return(pilotVM); }