0
請幫助ASP.NET MVC 4 Web Api項目。我可以從我的api控制器中檢索JSON而不會出現問題,並且發佈似乎可行(我的UI已更新),但數據不在數據庫中。Web API客戶端發佈不到數據庫
// POST API/todoes 公共HttpResponseMessage郵政(待辦事項) { 項= _db.Todoes.Add(項目); var response = Request.CreateResponse(HttpStatusCode.Created,item);
string uri = Url.Link("DefaultApi", new { id = item.TodoId });
response.Headers.Location = new Uri(uri);
return response;
}
self.create = function (formElement) {
// If valid, post the serialized form data to the web api
//$(formElement).validate();
//if ($(formElement).valid()) {
$.post(baseUri, $(formElement).serialize(), null, "json")
.done(function (o) { self.todoes.push(o); });
//}
}
「我是做錯了什麼?