示例#1
0
        public virtual JsonResult IndicatorsPageSearch([ModelBinder(typeof(DataTablesBinder))] IDataTablesRequest requestModel, bool isEdit = false)
        {
            var request = requestModel.ConvertToDataTableRequestViewModel();
            var filter  = request.ConvertToIndicatorsFilterViewModel();

            _cacheService.Add(base.FilterCacheKey, filter);

            var response = _fundService.GetIndicators(request);

            if (!response.IsValid)
            {
                response.Indicators = new RowsFilteredViewModel <RowIndicatorViewModel>()
                {
                    TotalElements = 0,
                    Rows          = new List <RowIndicatorViewModel>()
                };
            }

            var result = from c in response.Indicators.Rows
                         select new[]
            {
                c.IndicatorNumber,
                GetUrlForIndicator(c),
                c.TemplateVersion,
                DisplayEffectiveDate(c.EffectiveDate, c.IsActive),
                c.ExpirationDate,
                DisplayIsActiveIndicator(c, isEdit)
            };

            var jsonResponse = new DataTablesResponse(requestModel.Draw, result, response.Indicators.TotalElements, response.Indicators.TotalElements);

            return(Json(jsonResponse, JsonRequestBehavior.AllowGet));
        }