private async Task Filter() { DevicesForViewCollection.Clear(); DevicesCollection.Clear(); IEnumerable <ActiveDevice> groupedDevices = null; if (DateTimeSpan.IsDateValidate()) { _devices = await _activeDeviceRepository.GetActiveDevicesByDate(DateTimeSpan.FromDate, DateTimeSpan.ToDate); groupedDevices = _devices.GroupBy(x => x.IPAddress) .Select(x => x.First()); } if (groupedDevices != null) { DevicesCollection = new ObservableCollection <ActiveDevice>(groupedDevices); } }
private async Task Filter() { IEnumerable <RoomInfo> collection = null; if (DateTimeSpan.IsTimeInclude && DateTimeSpan.Validate()) { collection = await _roomRepository.FilterRooms(DateTimeSpan.FromDate, DateTimeSpan.ToDate, DateTimeSpan.FromTime, DateTimeSpan.ToTime); } else if (DateTimeSpan.IsDateValidate()) { collection = await _roomRepository.FilterRooms(DateTimeSpan.FromDate, DateTimeSpan.ToDate); } if (collection != null) { RoomInfoColleciton = new ObservableCollection <RoomInfo>(collection); } else { RoomInfoColleciton.Clear(); } }