vs中public方法返回类型有:HyResultBase、ExtJsResult、ExtJsListResult
1说明:函数XuanZeDuoGeJianGuanRenYuan返回方法类型为:HyResultBase
1 public HyResultBase XuanZeDuoGeJianGuanRenYuan(string[] JianGuanRenYuans, string[] JianGuanRenYuanIDs, Guid FangAnGuanLiID) 2 { 3 var r = new HyResultBase(); 4 5 6 //需要写的代码片段 7 8 9 return r; 10 11 }
1
1 public ExtJsResult<string> XuanQuWenShu(string WenShuMingCheng) 2 { 3 4 var r = new ExtJsResult<string>(); 5 6 7 //所需代码片段 8 9 10 11 return r; 12 }
//前端js代码为:
ajax.get('/Pc/FangAnZhiXingPublic/BaoCunJianChaLeiBie', params).then(function (response, opts) {
// ajax请求回调函数。返回值response.Success==true时代表成功,否则为出错。这段代码可以在前端界面按钮的代码中点击鼠标右键,就可以获取这段代码样例
});
a、此代码的功能为:
//后端VS中的代码为
[HttpGet]
[DontNeedPermit]
public HyResultBase BaoCunJianChaLeiBie(string FangAnMingChen)
{
var r = new HyResultBase();
var leiMing = _ioc.Query<JianChaLeiBie>()
.Where(e => e.LeiMing == FangAnMingChen)
.FirstOrDefault();
if (leiMing == null)
{
var jianChaLeiBie = new JianChaLeiBie()
{
LeiMing = FangAnMingChen,
IsWanCheng =true
};
jianChaLeiBie.Insert().SaveToDBAsync().Wait();
}
else
{
var xiaFaShiJian = _ioc.Query<FangAnGuanLi>().FirstOrDefault().XiaFaShiJian;
var xiaFaDanWei = _ioc.Query<FangAnGuanLi>().FirstOrDefault().XiaFaDanWei;
if (xiaFaShiJian != null&& xiaFaDanWei!=null)
throw new HyException($"{FangAnMingChen} 方案已添加,请更改方案名称!");
}
return r;
}
此段代码的功能为: