public virtual ViewResult Manage(bool?showAllPrograms) { var viewModel = new DashboardViewModel() { ShowAllPrograms = showAllPrograms.HasValue && showAllPrograms.Value, }; IEnumerable <FlightProgram> programs = null; IEnumerable <AircraftMDS> aircraft = null; if (viewModel.ShowAllPrograms) { programs = flightProgramsRepository.GetAllPrograms(); } else { programs = flightProgramsRepository.GetAllActivePrograms(); } if (viewModel.ShowAllPrograms) { aircraft = flightProgramsRepository.GetAllAircrafts(); } else { aircraft = flightProgramsRepository.GetAllActiveAircraftMds(); } var positions = flightProgramsRepository.GetAllPositions(); viewModel.Aircrafts = Mapper.Map <IEnumerable <AircraftMDS>, IEnumerable <AircraftViewModel> >(aircraft); viewModel.Positions = Mapper.Map <IEnumerable <Position>, IEnumerable <PositionViewModel> >(positions); viewModel.FlightPrograms = Mapper.Map <IEnumerable <FlightProgram>, IEnumerable <FlightProgramListItemViewModel> >(programs); return(View(Views.Manage, viewModel)); }