2013-04-30 60 views
0

我想知道如何使用REST控制檯(chrome插件)發送參數'foo'。他應該作爲JSON發送。將JSON傳遞到使用REST控制檯的操作 - MVC

塊引用

public class ComandaEletronicaWSController : Controller 
{ 
    [HttpPost] 
    public JsonResult ComandaServlet(Foo foo) 
    { 
     var action = Request.QueryString["Action"]; 

     return Json(new { Ok = true }); 
    } 
} 
public class Foo 
{ 
    public int bar { get; set; } 
    public int beer { get; set; } 
} 

回答

6

你需要傳遞到請求負載。

enter image description here

選擇內容類型

應用/ JSON

,並把你的JSON的RAW身體

+0

而且,如果你想通過2個參數? ? (想象一下foo1和foo2) – jjmartinez 2014-01-16 18:03:46

+1

請求正文只能有一個參數。如果你想傳遞多個數據,你需要封裝在某個數組中...... [foo1:{},foo2:{}] – 2014-01-16 19:08:54

相關問題