public ApprenticeshipSearchViewModel(ApprenticeshipSearchViewModel viewModel) : base(viewModel) { Keywords = viewModel.Keywords; LocationType = viewModel.LocationType; ApprenticeshipLevel = viewModel.ApprenticeshipLevel; Category = viewModel.Category; SubCategories = viewModel.SubCategories; SearchMode = viewModel.SearchMode; }
public LocationViewModel(ApprenticeshipSearchViewModel model) { if (model != null) { Name = model.Location; Longitude = model.Longitude.GetValueOrDefault(); Latitude = model.Latitude.GetValueOrDefault(); } }
public ApprenticeshipSearchViewModel(ApprenticeshipSearchViewModel viewModel) : base(viewModel) { Keywords = viewModel.Keywords; LocationType = viewModel.LocationType; ApprenticeshipLevel = viewModel.ApprenticeshipLevel; Category = viewModel.Category; SubCategories = viewModel.SubCategories; SearchMode = viewModel.SearchMode; SearchField = viewModel.SearchField; SavedSearches = viewModel.SavedSearches; DisplaySubCategory = viewModel.DisplaySubCategory; DisplayDescription = viewModel.DisplayDescription; DisplayDistance = viewModel.DisplayDistance; DisplayClosingDate = viewModel.DisplayClosingDate; DisplayStartDate = viewModel.DisplayStartDate; DisplayApprenticeshipLevel = viewModel.DisplayApprenticeshipLevel; DisplayWage = viewModel.DisplayWage; LocationSearches = Enumerable.Empty <ApprenticeshipSearchViewModel>(); }
public static ApprenticeshipSearchViewModel FromSearchUrl(string searchUrl) { if (string.IsNullOrWhiteSpace(searchUrl)) { return(null); } var searchUri = new Uri(new Uri("http://base"), searchUrl); var queryStringParams = HttpUtility.ParseQueryString(searchUri.Query); var searchModel = new ApprenticeshipSearchViewModel(); searchModel.SearchMode = queryStringParams.Get("SearchMode") != null ? (ApprenticeshipSearchMode)Enum.Parse(typeof(ApprenticeshipSearchMode), queryStringParams.Get("SearchMode")) : ApprenticeshipSearchMode.Keyword; searchModel.SortType = queryStringParams.Get("SortType") != null ? (VacancySearchSortType)Enum.Parse(typeof(VacancySearchSortType), queryStringParams.Get("SortType")) : VacancySearchSortType.Relevancy; searchModel.LocationType = queryStringParams.Get("LocationType") != null ? (ApprenticeshipLocationType)Enum.Parse(typeof(ApprenticeshipLocationType), queryStringParams.Get("LocationType")) : ApprenticeshipLocationType.NonNational; searchModel.Latitude = queryStringParams.Get("Latitude").GetValueOrNull <double>(); searchModel.Longitude = queryStringParams.Get("Longitude").GetValueOrNull <double>(); searchModel.WithinDistance = queryStringParams.Get("WithinDistance").GetValueOrDefault(5); searchModel.ResultsPerPage = queryStringParams.Get("ResultsPerPage").GetValueOrDefault(5); searchModel.Keywords = queryStringParams.Get("Keywords"); searchModel.Location = queryStringParams.Get("Location"); searchModel.ApprenticeshipLevel = queryStringParams.Get("ApprenticeshipLevel"); searchModel.SearchField = queryStringParams.Get("SearchField"); searchModel.Category = queryStringParams.Get("Category"); searchModel.SubCategories = queryStringParams.Get("SubCategories") != null?queryStringParams.Get("SubCategories").Split(',') : null; return(searchModel); }