protected Expression <Func <Models.TestingSearchResultItem, bool> > AddDefaultSearchCriteria(Expression <Func <Models.TestingSearchResultItem, bool> > predicate) { Expression <Func <Models.TestingSearchResultItem, bool> > expression = predicate; if (!string.IsNullOrEmpty(Owner)) { expression = expression.And((Models.TestingSearchResultItem x) => x.Owner == FormattingHelper.GetCompactUserName(Owner)); } if (HostItem != null) { expression = expression.And((Models.TestingSearchResultItem x) => x.HostItemPartial == FieldFormattingHelper.FormatUriForSearch(HostItem)); } if (!string.IsNullOrEmpty(SearchText)) { expression = expression.And((Models.TestingSearchResultItem x) => x.SearchText.Contains(SearchText)); } if (TestUri != null) { expression = expression.And((Models.TestingSearchResultItem x) => x.Uri == TestUri); } if (!ID.IsNullOrEmpty(DeviceId)) { expression = expression.And((Models.TestingSearchResultItem x) => x.DeviceId == DeviceId); } return(expression); }