在 Postman 中使用 post 时出错

Error while using post in Postman

我正在尝试使用 Post 方法以 JSON 格式传递原始数据并将其存储在具有属性但显示错误的 class 中。
我在值控制器中的代码-

    [HttpPost]
    public void AddEmployee()
    {
        HttpWebRequest myHttpWebRequest`= (HttpWebRequest)WebRequest.Create("http://localhost:50278/api/values/AddEmployee");

        HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();

    ////////Above line is giving error///////

    Stream receiveStream = myHttpWebResponse.GetResponseStream();
    DataContractJsonSerializer serializer =new DataContractJsonSerializer(typeof(Models.Employee));
    Models.Employee user = (Models.Employee)serializer.ReadObject(receiveStream);


    }

Class 我想将数据存储在什么地方

Models.Employee
{
     public string FirstName { get; set; }
     public string MiddleName { get; set; }
     public string LastName { get; set; }
     public Nullable<System.DateTime> DOB { get; set; }
     public Nullable<System.DateTime> DOJ { get; set; }
     public Nullable<short> IsActivce { get; set; }
}

我传入的命令 Postman Post http://localhost:50278/api/values/AddEmployee

有数据

[
{   
"FirstName" : "ABDCD",
"MiddleName" :"sajsoa",
"LastName"  : "KSJFHF",
"DOB":1994-01-12 00:00:00.0001994-01-12 00:00:00.000,
"DOJ":1994-01-12 00:00:00.0001994-01-12 00:00:00.000,
"Isactive" : 1
}
]

我收到以下错误:
System.Net.WebException 出现在 System.dll 中,但未在用户代码中处理。
附加信息:

The remote server returned an error: (405) Method Not Allowed. 

请问为什么显示错误,日期格式是否正确?

你试过吗?

[HttpPost]
public void AddEmployee([FromBody]Models.Employee user)
{
   EService eserv = new EService();
    eserv.Addemp(user);
}