标签:
int detailId = Convert.ToInt32(id); BillLoanApplyDetail model = _billLoadApplyDetail.GetBillLoanApplyDetailById(detailId); Dictionary<string, string> dictList = new Dictionary<string, string>(); if (model != null) { PropertyInfo[] ps = model.GetType().GetProperties(); foreach (PropertyInfo info in ps) { if (info.Name.ToLower() != "id") { string descriptionName = ((DescriptionAttribute)Attribute.GetCustomAttribute(info, typeof(DescriptionAttribute))).Description;// 属性值 var infoValue = info.GetValue(model); dictList.Add(descriptionName, infoValue!=null?info.GetValue(model).ToString():string.Empty); } } return Json(dictList, JsonRequestBehavior.AllowGet); } else { return Json("没有详情",JsonRequestBehavior.AllowGet); }
标签:
原文地址:http://www.cnblogs.com/honghong75042/p/4585418.html