public static List <ResortModel> ApplyFilter() { var result = Resorts.Where(resort => resort.Rating >= Filter.MinRating && resort.Rating <= Filter.MaxRating); if (!string.IsNullOrEmpty(Filter.Location)) { result = result.Where(resort => resort.Location == Filter.Location); } var diseases = Mapper.Map <List <DiseaseModel> >(Filter.Diseases.Where(disease => disease.IsChecked)); if (diseases.Any()) { result = result.Where(resort => resort.Diseases.Select(disease => disease.Name).Intersect(diseases.Select(disease => disease.Name)).Any()); } if (Filter.IsSanatorium) { result = result.Where(resort => resort.IsSanatorium); } if (Filter.Season != SeasonEnum.Any) { result = result.Where(resort => resort.Seasons.Contains(Filter.Season)); } return(result.ToList()); }
public static List <ResortModel> GetSponsored() { return(Resorts.Where(resort => resort.IsSponsored).ToList()); }