12

public static class PodborViewModelExtension { public static void FilterByRooms(this PodborViewModel podborViewModel, string[] roomArray) { podborViewModel.Apartments = podborViewModel.Apartments.Where(x => roomArray.Any() && roomArray.Contains(x.RoomsCount.ToString())).ToList(); } public static void FilterSliders(this PodborViewModel podborViewModel, PodborFilterViewModel filter) { podborViewModel.Apartments = podborViewModel.Apartments .Where(x=>x.PriceTotal>=filter.MinPrice && x.PriceTotal <= filter.MaxPrice) .Where(x => x.AreaTotal >= filter.MinSquare && x.AreaTotal <= filter.MaxSquare) .Where(x => int.Parse(x.Floor.Title) >= filter.MinFloor && int.Parse(x.Floor.Title) <= filter.MaxFloor).ToList(); } }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.