Esempio n. 1
0
        public void Can_Get_Filtered_Paged_For_Date_Range(int count, int daysAgo, int expected)
        {
            Scaffold.Instances(count);

            List <WorkflowInstanceViewModel> results = _service.GetFilteredPagedInstancesForDateRange(DateTime.Now.AddDays(daysAgo), expected, 1, "3");

            // all instances are incomplete, so return regardless of daysAgo value
            Assert.Equal(expected, results.Count);
        }
Esempio n. 2
0
        public IHttpActionResult GetFilteredPagedInstancesForDateRange(int days, string filter = "", int?count = null, int?page = null)
        {
            try
            {
                List <WorkflowInstance> instances =
                    _instancesService.GetFilteredPagedInstancesForDateRange(DateTime.Now.AddDays(days * -1), count, page, filter);

                return(Json(new
                {
                    items = instances,
                    count,
                    page,
                    filter
                }, ViewHelpers.CamelCase));
            }
            catch (Exception ex)
            {
                const string msg = "Error getting tasks for date range";
                Log.Error(msg, ex);
                return(Content(HttpStatusCode.InternalServerError, ViewHelpers.ApiException(ex, msg)));
            }
        }