Пример #1
0
        public void Can_Get_By_NodeId()
        {
            const int nodeId = 1075;

            _service.InsertInstance(Scaffold.Instance(Guid.NewGuid(), 1, nodeId));

            List <WorkflowInstanceViewModel> instances = _service.GetByNodeId(nodeId, 1, 10);

            Assert.NotNull(instances);
            Assert.Equal(nodeId, instances.First().NodeId);
        }
Пример #2
0
        public IHttpActionResult GetAllInstancesByNodeId(int nodeId, int count, int page)
        {
            try
            {
                List <WorkflowInstance> workflowInstances = _instancesService.GetByNodeId(nodeId, page, count);

                return(Json(new
                {
                    items = workflowInstances,
                    totalPages = (int)Math.Ceiling(_instancesService.CountAll() / count),
                    page,
                    count
                }, ViewHelpers.CamelCase));
            }
            catch (Exception e)
            {
                const string error = "Error getting workflow instances";
                Log.Error(error, e);
                return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(e, error)));
            }
        }