private IQueryable <Person> GetVolunteersForDateQueryable(int disasterId, DateTime date, bool checkedInOnly, IEnumerable <int> inClusterIds) { if (disasterId <= 0) { throw new ArgumentException("disasterId must be greater than zero", "disasterId"); } var inClusterIdsArray = new int [0]; if (inClusterIds != null) { inClusterIdsArray = inClusterIds.ToArray(); } var hasClusters = inClusterIdsArray.Length == 0; var people = from p in _dataService.Persons join c in Commitment.FilteredByStatus(_dataService.Commitments, checkedInOnly) on p.Id equals c.PersonId where c.DisasterId == disasterId where date >= c.StartDate && date <= c.EndDate where hasClusters || inClusterIdsArray.Any(cid => cid == c.ClusterId) select p; return(people.Distinct()); }
private IQueryable <Person> GetPeople(int disasterId, bool checkedInOnly) { if (disasterId <= 0) { throw new ArgumentException("disasterId is invalid.", "disasterId"); } var people = from p in _dataService.Persons join c in Commitment.FilteredByStatus(_dataService.Commitments, checkedInOnly) on p.Id equals c.PersonId where c.DisasterId == disasterId select p; return(people.Distinct()); }