2012-12-28 66 views
-1

我需要從json格式獲取列表模型。如何從json格式獲取列表的實際操作?

我有作用:

[HttpPost] 
public ActionResult SaveKo(List<UserViewModel> model) 
{ 
    return View(); 
} 

我發送JSON數組:

ko.utils.postJson('@Url.Action("SaveKo", "User")', { model: self.users }); 

格式頭:

Request URL:http://localhost:10001/user/SaveKO 
Request Method:POST 
Status Code:500 Internal Server Error 
Request Headersview source 
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 
Accept-Charset:windows-1251,utf-8;q=0.7,*;q=0.3 
Accept-Encoding:gzip,deflate,sdch 
Accept-Language:ru-RU,ru;q=0.8,en-US;q=0.6,en;q=0.4 
Cache-Control:max-age=0 
Connection:keep-alive 
Content-Length:4576 
Content-Type:application/x-www-form-urlencoded 
Cookie:ASP.NET_SessionId=abu54mtmtjq0h2551vt0o2ug; .fairzeit=7E91AC1F2A977E037118C7F1564F45B8B89E74C897FC919811C29652C6123F23B2C979CD4B51F1BC4C271C93E95A81E807D00E5B47AFCD87ECAE1BA5245F73474B5AB610E19A10CB16C050D6899D23AC15E3530E1D85997B553F07681F5304DA837DFA5766F3AC9BF0CBFC2B31436E708BFA95EC5AEA58FEFB717DDE350DBC57665AA230D5615DE9AFEB1021C3A45B98C726598CF2E9E8E90FEC1C488B3C8DAC 
Host:localhost:10001 
Origin:http://localhost:10001 
Referer:http://localhost:10001/user/indexko 
User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11 
Form Dataview URL encoded 
0:{"PersonalNummer":"1","Name":"Admin","Vorname":"Admin","Login":"none","EMail":"[email protected]"} 
1:{"PersonalNummer":"2","Name":"Test","Vorname":"Test","Login":"test_disponent","EMail":"[email protected]"} 
2:{"PersonalNummer":"3","Name":"Bennemann","Vorname":"Christian","Login":"cbenn","EMail":"[email protected]"} 

回答

0
ko.utils.postJson('@Url.Action("SaveKo", "User")', self.users); 
相關問題