2013-04-30 59 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

相关问题