/// <summary> /// </summary> /// <param name="keyword"> /// </param> /// <param name="ordering"> /// </param> /// <param name="pageIndex"> /// </param> /// <param name="pageSize"> /// </param> /// <param name="search"> /// </param> /// <returns> /// </returns> public async Task <IActionResult> IndexAsync(string keyword, string ordering, int pageIndex = 1, int pageSize = 20, bool search = false, bool toExcelFile = false) { var model = _iDomainLabelService.GetAll() .Select( a => new { a.Label, a.LabelType, a.Heat, a.Id }).Search(keyword); if (search) { model = model.Search(Request.Query); } if (!string.IsNullOrEmpty(ordering)) { model = model.OrderBy(ordering); } else { model = model.OrderByDescending(a => a.Heat); } if (toExcelFile) { return(model.ToExcelFile()); } return(View(model.PageResult(pageIndex, pageSize))); }
public async Task <IViewComponentResult> InvokeAsync() { var model = _IDomainLabelService.GetAll(a => a.LabelType == LabelTypes.用户搜索); return(View(model)); }