示例#1
0
        public ResponseModel GetListFamily()
        {
            if (_handle == null)
            {
                _handle = new NationsHandle();
            }
            ResponseModel responseModel = new ResponseModel();

            try
            {
                responseModel.description = "请求数据成功!";
                responseModel.success     = true;
                DataTable dt = _handle.GetListFamily();
                if (dt != null)
                {
                    List <FamilyModel> lsFamily = dt.DataTableToList <FamilyModel>();
                    FeatureModel       features = new FeatureModel();
                    features.displayFieldName = "name";
                    features.primaryFieldName = "id";
                    features.features         = JsonConvert.DeserializeObject(JsonConvert.SerializeObject(lsFamily));//(Contact[])ls.ToArray();
                    responseModel.response    = features;
                }
            }
            catch (Exception ex)
            {
                responseModel.description = ex.Message.ToString();
                responseModel.success     = false;
                responseModel.response    = JsonConvert.DeserializeObject("{}");
            }
            return(responseModel);
        }
示例#2
0
 /// <summary>
 /// 构造函数并实例化操作对象
 /// </summary>
 public NationsController()
 {
     if (_handle == null)
     {
         _handle = new NationsHandle();
     }
 }