0
我拉琴測試此網址的[FORMBODY參數爲空?
我的解決方案的時候,但不wroking我 Fiddler testing API Post passing a [Frombody] class
User-Agent: Fiddler
Host: localhost:4086
Content-Length: 193
Content-type: application/json; charset=utf-8
上面的格式顯示空的集合對象
創建的插入方法,使用實體在MySQL中插入數據public class InsertController : BaseApiController
{
static readonly IInsertMaster obj = new InsertMaster();
[HttpPost]
public HttpResponseMessage PostUser(collection_master collection)
{
if (collection == null)
return Request.CreateResponse(HttpStatusCode.BadRequest, "not created");
if (obj.PostUser(collection))
{
return Request.CreateResponse(HttpStatusCode.Created, TheModelFactory.create(collection));
}
else
return Request.CreateResponse(HttpStatusCode.BadRequest, "Could not save to the database");
}
}
輸入:
{"CustomerID":"10","AmountRecevied":1000","Date_Time":"2014-03-03 10:00:00","Area":"banglore","AgentID":"1","Money_Receipt_No":"123456","Payment_Mode":"cheque","Money_Receipt_Photo":null}