/// <summary> /// /// </summary> /// <param name="request"></param> /// <returns></returns> public PagedQueryServicePerformanceResponse PagedQueryServicePerformances(PagedQueryServicePerformanceRequest request) { var page = request.Page ?? 1; var pageSize = request.PageSize ?? 20; using (var client = DbFactory.CreateClient()) { var total = 0; var list = client.Queryable <ServicePerformanceMonitor>() .WhereIF(!request.Keyword.IsNullOrEmpty(), t => t.Name.Contains(request.Keyword)) .Select(t => new QueryServicePerformanceItem() { Id = t.Id, Name = t.Name, ElapsedMs = t.ElapsedMs, HttpRequestId = t.HttpRequestId, AddTime = t.AddTime, }) .OrderBy("id DESC") .ToPageList(page, pageSize, ref total); return(new PagedQueryServicePerformanceResponse() { List = list, Page = page, PageSize = pageSize, TotalCount = total }); } }
public IActionResult PagedList(PagedQueryServicePerformanceRequest request) { var list = _servicePerformanceService.PagedQueryServicePerformances(request); var result = new { Code = 0, Message = "", Total = list.TotalCount, Data = list.List }; return(Json(result)); }