Пример #1
0
 public void QueryActionCountsAsync(QueryActionCountsRequest request, Action <QueryActionCountsResponse, Exception> callback)
 {
     RpcRoot.JsonRpc.SignPostAsync(
         _controllerName,
         nameof(IAdminController.QueryActionCounts),
         request,
         callback,
         timeountMilliseconds: 5 * 1000);
 }
Пример #2
0
        public QueryActionCountsResponse QueryActionCounts([FromBody] QueryActionCountsRequest request)
        {
            if (request == null)
            {
                return(ResponseBase.InvalidInput <QueryActionCountsResponse>("参数错误"));
            }
            request.PagingTrim();
            var data = ActionCountRoot.QueryActionCounts(request, out int total);

            return(QueryActionCountsResponse.Ok(data, total));
        }
Пример #3
0
        public static List <ActionCountData> QueryActionCounts(QueryActionCountsRequest query, out int total)
        {
            List <ActionCountData> list = new List <ActionCountData>();
            bool isFilterByKeyword      = !string.IsNullOrEmpty(query.Keyword);

            if (isFilterByKeyword)
            {
                foreach (var item in _actionCounts)
                {
                    if (item.Key.Contains(query.Keyword))
                    {
                        list.Add(item.Value);
                    }
                }
            }
            else
            {
                list.AddRange(_actionCounts.Values);
            }
            total = list.Count;
            return(list.OrderBy(a => a.ActionName).Take(paging: query).ToList());
        }