Project GetProject(ListSprintsRequest request) { if (request.Project != null) { return(data.Theorise(request.Project)); } return(currentProjectProvider.GetCurrentProject()); }
public IList <Sprint> GetSprints(ListSprintsRequest request) { if (request == null) { throw new ArgumentNullException(nameof(request)); } return(data.Query <Sprint>() .Where(GetSpecification(request)) .OrderBy(x => x.StartDate.HasValue ? x.StartDate : x.CreationDate) .ToList()); }
// If this method needs to become any more complex, then break it away to a service of its own which gets // a spec from a request. ISpecificationExpression <Sprint> GetSpecification(ListSprintsRequest request) { var project = GetProject(request); ISpecificationExpression <Sprint> spec = projectSprintFactory(project); if (!request.ShowOpenSprints) { spec = spec.And(closedSprintFactory()); } if (!request.ShowClosedSprints) { spec = spec.And(openSprintFactory()); } return(spec); }