public async Task <List <NewsSearchResult> > ExecuteQuery(NewsSearchInput input, string source) { List <NewsSearchResult> result = new List <NewsSearchResult>(); foreach (IndustrySearch ind in input.industries) { List <News> IndustryNews = new List <News>(); foreach (string keyWord in ind.SearchKeyWords) { if (source == "google" || source == "all") { var searchResultGoogle = await _googleNewsRepository.List(keyWord, ind.Limit, ind.Name); IndustryNews.AddRange(searchResultGoogle); } if (source == "openCanada" || source == "all") { var searchResultOpenCanada = await _openCanadaRepository.List(keyWord, ind.Limit, ind.Name); IndustryNews.AddRange(searchResultOpenCanada); } } result.Add(new NewsSearchResult { Industry = ind.Name, News = IndustryNews }); } return(result); }
/// <summary> /// 列表 /// </summary> /// <returns></returns> //[AbpMvcAuthorize("Administration.News")] public ActionResult Index(int id = 1) { var model = new NewsSearchInput(); model.PageIndex = id; return(View(model)); }
/// <summary> /// 分页请求 /// </summary> /// <param name="input"></param> /// <param name="id"></param> /// <returns></returns> public Task <PagedList <NewsListDto> > List(NewsSearchInput input, int id) { int pageSize = 10; var query = _NewsRepository.GetAll() .WhereIf(!string.IsNullOrEmpty(input.Title), t => t.Title.Contains(input.Title)); int totalCount; var list = query.OrderBy(p => p.SortOrder).PageBy(id, pageSize, out totalCount); PagedList <NewsListDto> result = new PagedList <NewsListDto>(list.MapTo <List <NewsListDto> >(), id, pageSize, totalCount); return(Task.FromResult(result)); }
public async Task <ActionResult> List(NewsSearchInput searchModel, int id = 1) { var list = await _newsAppService.List(searchModel, id); return(PartialView("_PageTable", list)); }
public async Task <ActionResult <List <NewsSearchResult> > > PostOC([FromBody] NewsSearchInput SearchParams) { var result = await _queryNews.ExecuteQuery(SearchParams, "openCanada"); return(result); }