public JsonResult ExhibitionAreaList(int farmId) { using (var result = new ResponseResult <List <ExhibitionAreaListOutput> >()) { var exhibitionAreaList = _farmAreaService.GetAll(m => m.FarmId == farmId); if (exhibitionAreaList != null) { result.Entity = Mapper.Map <List <ExhibitionAreaListOutput> >(exhibitionAreaList.ToList()); SetJosnResult <List <ExhibitionAreaListOutput> >(result, 1, 0, result.Entity.Count, "获取农场展区列表成功!"); } else { result.IsSuccess = false; SetJosnResult <List <ExhibitionAreaListOutput> >(result, 1, 0, 0, "获取农场展区列表失败!"); } return(new JsonResultEx(result)); } }
public JsonResult FarmDetail(FarmDetailInput input) { using (var result = new ResponseResult <FarmDetailOutput>()) { var farm = _farmService.GetByKey(input.FarmId); var areaList = _farmAreaService.GetAll(m => m.FarmId == input.FarmId); var farmDetail = Mapper.Map <FarmDetailOutput>(farm); if (areaList != null && areaList.Any()) { farmDetail.AreaList = Mapper.Map <List <FarmArea> >(areaList); } result.Entity = farmDetail; result.Message = "获取农场详情成功!"; return(new JsonResultEx(result)); } }