Exemple #1
0
        public ActionResult GetTypeJson()
        {
            var treeList = new List <TreeSelectModel>();
            var data     = typeApp.GetList();

            foreach (var t in data)
            {
                if (t != null)
                {
                    TreeSelectModel treeModel = new TreeSelectModel();
                    treeModel.id   = t.ID.ToString();
                    treeModel.text = t.TypeName;
                    treeList.Add(treeModel);
                }
            }
            return(Content(treeList.ToJson()));
        }
 private object GetTypeList()
 {
     try
     {
         TypeApp typeApp = new TypeApp();
         var     data    = typeApp.GetList();
         Dictionary <string, object> dictionary = new Dictionary <string, object>();
         foreach (TypeEntity item in data)
         {
             var fieldItem = new
             {
                 encode   = item.ID,
                 fullname = item.TypeName
             };
             dictionary.Add(item.ID.ToString(), fieldItem);
         }
         return(dictionary);
     }
     catch (Exception ex)
     {
         throw;
     }
 }