Exemplo n.º 1
0
        public JsonResult Get(int page, int pageSize)
        {
            if (!this.permissionService.Authorize(StandardPermissionProvider.GetConsumption))
            {
                return(AccessDeniedJson());
            }

            var consumptions = consumptionService.GetConsumptionCategories(page, pageSize);

            if (consumptions == null)
            {
                return(null);
            }

            var models =
                Enumerable.Where(consumptions.Select(Mapper.Map <Consumption, ConsumptionModel>), model => model != null)
                .ToList();

            return(Json(
                       new
            {
                total = consumptions.TotalRecords,
                data = models
            },
                       JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
 protected override PagedResult <Consumption> GetCategories(int page, int pageSize)
 {
     return(consumptionService.GetConsumptionCategories(page, pageSize));
 }