0
我說這個。但是我的API部門conrtoller當我運行它的網站上說,它沒有找到,我不熟悉C#與做任何幫助..沒有HTTP資源被發現
[HttpDelete]
[AcceptVerbs("Delete")]
[ResponseType(typeof(Department))]
public override async Task<IHttpActionResult> Delete(Department tObj, bool? tagAsDeleteOnly)
{
_bll.Delete(tObj, tagAsDeleteOnly ?? true);
var result = await _bll.Save();
return Ok(new WebResult
{
Data = tObj,
Total = (int)result,
Result = result > 0
});
}
的錯誤說
{
"Message": "No HTTP resource was found that matches the request URI 'http://localhost:8933/api/Department/Delete'.",
"MessageDetail": "No action was found on the controller 'Department' that matches the request."
}
這是我傳遞 what i pass picture
這是我在我的前端
代碼delete(form) {
debugger
form.State = 2;
let id = form.Key;
//delete form.Key;
this.props.deleter('department/Delete', form);
}
,然後繼續
export const deleter = (url, params) => {
return(dispatch, getState, api) => {
api += 'api/';
return fetch(`${api}${url}`, {
method: 'DELETE',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(params)
})
.then(response => response.json())
.then(result => dispatch(departmentResult(result, types.DELETER)));
}
}
由[HttpDelete]屬性指定的是您確實發送刪除請求驗證這一點? –
怎麼辦你通過'部門'對象? –
我不知道你的意思是,但..即時通訊發送項目'api/Department/Delete'' @AlanBuchanan – LAGIM