五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

未設(shè)置[FromForm]致使未能接收到值

2022-01-01 14:45 作者:Tuple_元組  | 我要投稿

環(huán)境:前端是微信小程序,后端是.net6 webApi

前端代碼:

wx.request({
url:?app.globalData.serverHttpUrl?+?"/Comment/",
?method:?"DELETE",
?data:?{CommentId:?e.currentTarget.dataset.commentid,?},
header:?{'content-type':?'application/x-www-form-urlencoded'},
success:?(res)?=>?{}
})

后端代碼:

[HttpDelete]
public async Task<JsonResult> DeleteAsync([FromForm] int CommentId)
?{
? ? if (await _DataCommentRep.DelOneByIdAsync(CommentId) < 1){
? ? ? ?return new JsonResult(new VMResult<string>() { ResultCode = -1, ResultMsg = "S:刪除失敗", ResultEntity = null });?}
? ? ??return new JsonResult(new VMResult<string>() { ResultCode = 0, ResultMsg = "S:刪除成功", ResultEntity = null });
??}

注:如后端不使用 “[FromForm]” 則?CommentId 值始終為 0 即取不到值。

此外,需注意后端為 DELETE或GET時(shí),前端如不使用URL傳值的方式,應(yīng)設(shè)'content-type':?'application/x-www-form-urlencoded'



未設(shè)置[FromForm]致使未能接收到值的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
民乐县| 长岭县| 沂南县| 馆陶县| 额敏县| 四会市| 察隅县| 延吉市| 个旧市| 武功县| 伊金霍洛旗| 建湖县| 柳河县| 隆昌县| 杭锦旗| 绥宁县| 张掖市| 子长县| 临朐县| 安仁县| 铜梁县| 浪卡子县| 泸溪县| 深水埗区| 溧水县| 黄山市| 安吉县| 龙岩市| 寿宁县| 大兴区| 乌恰县| 财经| 报价| 清水河县| 崇仁县| 舟曲县| 长葛市| 彭水| 万盛区| 新平| 沁阳市|