Esempio n. 1
0
        public ApiResult List(string sourceId, int pageNo = 1, int limit = 10)
        {
            Argument.ThrowIfNullOrEmpty(sourceId, "评价Id");
            var id = sourceId.ToGuid();

            if (id.Equals(Guid.Empty))
            {
                throw new WebApiInnerException("0001", "评价Id格式不正确");
            }
            int totalCount;
            var evaluates = _evaluateService.LoadByPage(id, EvaluateModule.Instance, SourceType, out totalCount, pageNo, limit);



            var list = evaluates.Select(evaluate => new ListEvaluateModel(evaluate)).ToList();

            var result = new ApiResult();
            var data   = new
            {
                TotalCount = totalCount,
                Evaluates  = list
            };

            result.SetData(data);
            return(result);
        }
Esempio n. 2
0
        public ActionResult ListOnPage(string sourceType, Guid sourceId)
        {
            var result    = new DataJsonResult();
            var pageIndex = Request.Get("pageIndex").To(1);
            var pageSize  = Request.Get("pageSize").To(10);
            int totalCount;
            var evaluates = _evaluateService.LoadByPage(sourceId, null, sourceType, out totalCount, pageIndex, pageSize);

            result.Data = new { TotalCount = totalCount, Evaluates = evaluates };
            return(Json(result, JsonRequestBehavior.AllowGet));
        }