예제 #1
0
        public PaginatedList <ProcessExecutionViewModel> View(
            [FromQuery(Name = "$filter")] string filter   = "",
            [FromQuery(Name = "$orderby")] string orderBy = "",
            [FromQuery(Name = "$top")] int top            = 100,
            [FromQuery(Name = "$skip")] int skip          = 0
            )
        {
            ODataHelper <ProcessExecutionViewModel> oData = new ODataHelper <ProcessExecutionViewModel>();

            string queryString = "";

            if (HttpContext != null &&
                HttpContext.Request != null &&
                HttpContext.Request.QueryString != null &&
                HttpContext.Request.QueryString.HasValue)
            {
                queryString = HttpContext.Request.QueryString.Value;
            }

            oData.Parse(queryString);
            Guid parentguid = Guid.Empty;
            var  newNode    = oData.ParseOrderByQuerry(queryString);

            if (newNode == null)
            {
                newNode = new OrderByNode <ProcessExecutionViewModel>();
            }

            Predicate <ProcessExecutionViewModel> predicate = null;

            if (oData != null && oData.Filter != null)
            {
                predicate = new Predicate <ProcessExecutionViewModel>(oData.Filter);
            }
            int take = (oData?.Top == null || oData?.Top == 0) ? 100 : oData.Top;

            return(processExecutionLogManager.GetProcessAndAgentNames(predicate, newNode.PropertyName, newNode.Direction, oData.Skip, take));
        }