.net中MVC Webapi多参数调用控制器方法

http://blog.csdn.net/wulex/article/details/71545471

 

路由

public static void Register(HttpConfiguration config)
{

// Web API routes
config.MapHttpAttributeRoutes();

config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "dzopen/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional }
);

}

 

控制器  使用Get请求

 

 

[HttpGet]
public HttpResponseMessage querymemberbymobileno([FromUri] userinfo user)
{
// name = HttpUtility.UrlEncode(name);

string resp = "";
var resps = new HttpResponseMessage(HttpStatusCode.OK);
resps.Content = new StringContent(resp, Encoding.UTF8, "application/xml");
return resps;

}
[HttpGet]
public string Get(string id)
{
return "Value";
}

}

public class userinfo
{
public string shop_card_id{get;set;}
public string mobile_no{get;set;}
public string category{get;set;}
public string method{get;set;}
public string format{get;set;}
public string v{get;set;}
public string app_key{get;set;}
public string sign{get;set;}
public string timestamp{get;set;}
public string sign_method { get; set; }
}
}

 

转载于:https://www.cnblogs.com/liwp/p/7244700.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值