我的路线:
// Web API routes
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
// Controllers with Actions
// To handle routes like `/api/VTRouting/route`
config.Routes.MapHttpRoute(
name: "ControllerAndAction",
routeTemplate: "api/{controller}/{action}/{id}",
defaults: new { id = RouteParameter.Optional ,extension = RouteParameter.Optional }
);
我的API是:
[System.Web.Mvc.HttpPost]
[System.Web.Mvc.ActionName("san")]
public HttpResponseMessage san([FromBody]Login value)
{
var result = db.SSI_Member_Registation.Where(c => c.InqID == value.userid && c.BirthDt == value.Password).FirstOrDefault();
return Request.CreateResponse(HttpStatusCode.OK, result);
}
//// POST api/values
[System.Web.Mvc.HttpPost]
[System.Web.Mvc.ActionName("san1")]
public void Post([FromBody]string value)
{
}
我将参数作为Json传递并排成行 [![在此处输入图像说明] [1]] [1]
我做错了什么?
答案 0 :(得分:3)
更改路线的顺序:
WHERE (SM.CourseID=@CourseID OR @CourseID=0)
AND
(SM.ClassID=@ClassID OR @ClassID=0)
AND
(SM.ClassSectionID=@ClassSectionID OR @ClassSectionID=0)
AND
SD.StudentID<>SS.StudentID
如果您先注册默认值,它将覆盖其余部分。