Javascript asp.net core 3 axios don';我不能如期发帖

Javascript asp.net core 3 axios don';我不能如期发帖,javascript,c#,asp.net-core,axios,asp.net-core-3.0,Javascript,C#,Asp.net Core,Axios,Asp.net Core 3.0,在web应用程序客户端,我使用axios发布请求 以下是我的axios post请求: axios({ method: 'post', url: '/CorporateRequests/PostRequestProcess', headers: { 'Content-Type': 'application/json' },

在web应用程序客户端,我使用axios发布请求

以下是我的axios post请求:

                axios({
                    method: 'post',
                    url: '/CorporateRequests/PostRequestProcess',
                    headers: { 'Content-Type': 'application/json' },
                    data: JSON.stringify(this.postingModel)
                }).then(function (response) {
                    if (response.status === 200 && response.data.status === 200) {
                        window.location.href = "/Service/Process";
                    } else {
                        self.$parent.showToast('HATA', 'Kayıt işlemi yapılamadı', 'error');
                    }
                }).catch(function (error) {
                    self.$parent.showToast('HATA', 'Kayıt işlemi yapılamadı', 'error');
                });
处理来自客户端的post请求的url如下所示:

Task<JsonResult> PostRequestProcess([FromBody]RequestProcessModel postingModel)
这是我的RequestProcessModel

public class RequestProcessModel
{
    public RequestProcessModel()
    {
        RequestDetail = new List<RequestProcessDetail>();
    }
    public Guid RequestId { get; set; }
    public bool EditMode { get; set; }
    public Guid? RequestProcessId { get; set; }
    public List<RequestProcessDetail> RequestDetail { get; set; }
}

public class RequestProcessDetail
{
    public Guid? ProcessDetailId { get; set; }
    public Guid ItemId { get; set; }
    public bool AddBill { get; set; }
    public string Description { get; set; }
    public string ItemName { get; set; }
    public decimal Price { get; set; }
}
公共类RequestProcessModel
{
公共RequestProcessModel()
{
RequestDetail=新列表();
}
公共Guid RequestId{get;set;}
公共bool编辑模式{get;set;}
公共Guid?RequestProcessId{get;set;}
公共列表请求详细信息{get;set;}
}
公共类RequestProcessDetail
{
公共Guid?ProcessDetailId{get;set;}
公共Guid ItemId{get;set;}
公共bool AddBill{get;set;}
公共字符串说明{get;set;}
公共字符串ItemName{get;set;}
公共十进制价格{get;set;}
}

我正在使用ASP.Net Core 3,需要一些帮助。

您遇到的问题是您正在向控制器提交JSON字符串

data: JSON.stringify(this.postingModel)
您可以像这样更改代码

axios({
    method: 'post',
    url: '/CorporateRequests/PostRequestProcess',
    headers: { 'Content-Type': 'application/json' },
    data: this.postingModel
}).then(function (response) {
    if (response.status === 200 && response.data.status === 200) {
        window.location.href = "/Service/Process";
    } else {
        self.$parent.showToast('HATA', 'Kayıt işlemi yapılamadı', 'error');
    }
}).catch(function (error) {
    self.$parent.showToast('HATA', 'Kayıt işlemi yapılamadı', 'error');
});
或者你也可以用这个方法

axios.post(url, data, config)

请不要包括问题的答案(改为单独的答案)。
axios.post(url, data, config)