public SearchDataViewModel( IEnumerable<CenterType> allCenterTypes, IDictionary<MedicalType, bool> medicalTypesDictionary) { SearchData = new SearchData(); AllCenterTypes = allCenterTypes; MedicalTypesDictionary = medicalTypesDictionary; }
public static SearchDataViewModel CreateUsingLastSearchData( IEnumerable<CenterType> allCenterTypes, IEnumerable<MedicalType> allMedicalTypes, SearchData lastSearchData) { var medicalTypesDictionary = allMedicalTypes.ToDictionary(type => type, type => WasMedicalTypeSelected(type, lastSearchData)); return new SearchDataViewModel { SearchData = lastSearchData, AllCenterTypes = allCenterTypes, MedicalTypesDictionary = medicalTypesDictionary }; }
private static bool WasMedicalTypeSelected(MedicalType medicalType, SearchData lastSearchData) { return lastSearchData.SearchedMedicalTypes.Contains(medicalType); }