Ejemplo n.º 1
0
        public JsonResult FarmBookList(FarmBookListInput input)
        {
            CheckPermission();
            using (var result = new ResponseResult <FarmBookListOutput>())
            {
                long totalCount;
                var  farmBookList = _farmBookService.GetAll <DateTime>(m => m.FarmId == input.FarmId, null, m => m.CreateTime, input.PageIndex, input.PageSize, out totalCount, "ReservedUser,T_DEMONSTRATION_FARM");
                if (farmBookList != null && farmBookList.Any())
                {
                    var farmBookListOutput = new FarmBookListOutput();
                    farmBookListOutput.FarmName = farmBookList.ElementAt(0).T_DEMONSTRATION_FARM.Name;
                    result.Entity = farmBookListOutput;
                    result.Entity.FarmBookList = Mapper.Map <List <FarmBookItem> >(farmBookList);
                }

                SetJosnResult(result, input.PageIndex, input.PageSize, totalCount, "获取农场报名列表成功!");
                return(new JsonResultEx(result));
            }
        }
Ejemplo n.º 2
0
        public ActionResult FarmBookList(FarmBookListInput input)
        {
            CheckPermission(GetLoginInfo().User.Id, CurrentUrl);
            if (input.PageIndex == 0)
            {
                input.PageIndex = 1;
                input.PageSize  = 10;
            }

            var parameter = ModelHelper.GetPropertyDictionary <FarmBookListInput>(input);
            var result    = PostStandardWithSameControllerAction <FarmBookListOutput>(this, parameter);

            if (result.IsSuccess)
            {
                var model = new MultiModel <FarmBookListOutput>(result.IsSuccess, input.PageIndex, input.PageSize, (int)result.TotalNums, result.Entity);
                return(View(model));
            }

            return(View());
        }