示例#1
0
        public JsonResult List([DataSourceRequest] DataSourceRequest request)
        {
            // Must Convert to Json from kendo data source request , because filter using abstract class
            AjaxViewModel    jsonViewModel       = new AjaxViewModel();
            DataSourceResult newDataSourceResult = new DataSourceResult();

            try
            {
                var json     = Utilities.GridUtilities.ConvertKendoRequestToJson(request);
                var endpoint = String.Format("{0}{1}", url, Route.Get);
                var result   = RestAPIHelper <CustomDataSourceResult <ListGroupGradeViewModel> > .Submit(json, Method.POST, endpoint, Request);

                newDataSourceResult.Data  = result.data;
                newDataSourceResult.Total = result.total;

                foreach (var item in result.data)
                {
                    item.ID = EncryptionHelper.EncryptUrlParam(item.ID);
                }
            }
            catch (Exception ex)
            {
                jsonViewModel.SetValues(false, null, String.Format("Failed\\nMessage: {0}", ex.GetBaseException().Message));
            }
            return(Json(newDataSourceResult));
        }