public ActionResult AddStageCheck(AddStageCheckViewModel viewModel) { StageCheck stageCheck = new StageCheck() { Date = viewModel.CheckDate, InstructorId = viewModel.InstructorId, PilotId = viewModel.PilotId, StageName = viewModel.StageName }; _dataService.AddPilotStageCheck(stageCheck); return PilotReview(viewModel.PilotId); }
public ActionResult AddStageCheck(int pilotId) { Member pilot = _dataService.GetMemberWithPilotData(pilotId); AddStageCheckViewModel viewModel = new AddStageCheckViewModel(); viewModel.CheckDate = DateTime.Now; viewModel.PilotId = pilotId; viewModel.PilotName = pilot.FullName; viewModel.AvailableStages = new Dictionary<string, string>(); string[] stagenames = Enum.GetNames(typeof(StageChecks)); foreach(var name in stagenames) { if(!pilot.StageChecks.Any(s => s.StageName == name)) viewModel.AvailableStages.Add(name, name.ToFriendlyString()); } int instructorId = ProfileCommon.GetProfile().MemberId; Member instructor = _dataService.GetMember(instructorId); viewModel.InstructorId = instructor.Id; viewModel.InstructorName = instructor.FullName; return View(ViewNames.AddStageCheck, viewModel); }