Пример #1
0
        public object Get(string text = null, string severity = null, string pid = null)
        {
            // iseverity = integer severity (best known way to handle (ignore) empty parameter severity="")
            int?iseverity = null;

            if (!string.IsNullOrEmpty(severity))
            {
                iseverity = int.Parse(severity);
            }

            // ipid = integer project ID (best known way to handle (ignore) empty parameter pid="")
            int?ipid = null;

            if (!string.IsNullOrEmpty(pid))
            {
                ipid = int.Parse(pid);
            }

            IssueSearchArgs args = new IssueSearchArgs {
                TextQuery = text, Severity = iseverity, ProjectId = ipid
            };

            Uri selfUri = typeof(IssueQueryResource).CreateUri(new { text = text, severity = severity, pid = pid });

            List <Issue> issues = IssueRepository.FindIssues(args);

            return(new Resources.IssueQueryResource
            {
                Issues = issues,
                SelfUri = selfUri
            });
        }
Пример #2
0
        public List <Issue> FindIssues(IssueSearchArgs args)
        {
            var query = Query().Where(i =>
                                      (string.IsNullOrWhiteSpace(args.TextQuery) || i.Title.Contains(args.TextQuery) || i.Description.Contains(args.TextQuery)) &&
                                      (args.Severity == null || args.Severity == i.Severity) &&
                                      (args.ProjectId == null || args.ProjectId == i.OwnerProject.Id));

            return(query.ToList());
        }