private JobAdSortExecution Sort(IHasId <Guid> member, JobAdSearchSortCriteria sortCriteria, Range range, Func <IJobAdSortService, Guid?, JobAdSortQuery, JobAdSearchResults> sort) { var criteria = new JobAdSortCriteria { SortCriteria = sortCriteria }; JobAdSearchResults results; var service = _serviceManager.Create(); try { results = sort(service, member == null ? (Guid?)null : member.Id, criteria.GetSortQuery(range)); } catch (Exception) { _serviceManager.Abort(service); throw; } _serviceManager.Close(service); return(new JobAdSortExecution { Criteria = criteria, Results = results, }); }
protected TListModel CreateEmptyList <TListModel>(IMember member, JobAdSortCriteria criteria, JobAdsPresentationModel presentation, JobAdListType listType) where TListModel : JobAdSortListModel, new() { var model = new TListModel { Criteria = criteria, Presentation = presentation, ListType = listType, Results = new JobAdListResultsModel { TotalJobAds = 0, IndustryHits = new Dictionary <string, int>(), JobTypeHits = GetEnumHitsDictionary(new List <KeyValuePair <JobTypes, int> >(), JobTypes.All, JobTypes.None), JobAdIds = new List <Guid>(), JobAds = new Dictionary <Guid, MemberJobAdView>(), }, }; return(model); }