public ActionResult Add() { string SnNum = WebUtil.GetQueryStringValue <string>("SnNum", string.Empty); SupplierEntity entity = null; if (!SnNum.IsEmpty()) { ITopClient client = new TopClientDefault(); Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("CompanyID", CompanyID); dic.Add("SnNum", SnNum); string result = client.Execute(SupplierApiName.SupplierApiName_Single, dic); DataResult <SupplierEntity> dataResult = JsonConvert.DeserializeObject <DataResult <SupplierEntity> >(result); entity = dataResult.Result; } entity = entity.IsNull() ? new SupplierEntity() : entity; ViewBag.Entity = entity; entity.SupType = entity.SupType == 0 ? (int)ESupType.Cooperation : entity.SupType; ViewBag.SupplierType = EnumHelper.GetOptions <ESupType>(entity.SupType); return(View()); }