当前位置:Gxlcms > mysql > .netWebAPI2,returnHttpResponseMessagewithObjectContent

.netWebAPI2,returnHttpResponseMessagewithObjectContent

时间:2021-07-01 10:21:17 帮助过:23人阅读

public async TaskHttpResponseMessage Register(AllenRegistration model) { 1. Will return 400 Error return Request.CreateResponse( HttpStatusCode.BadReques t); 2. Will return Json Type like {return1:A,returnBL:B} return new HttpResponseMessa

public async Task Register(AllenRegistration model)

{

1.


Will return 400 Error

return Request.CreateResponse(HttpStatusCode.BadRequest);


2.

Will return Json Type like {"return1":"A","returnB"L:"B"}

return new HttpResponseMessage(HttpStatusCode.OK)

{
Content = new ObjectContent(new
{
return1="A",

return2="B"
}, Configuration.Formatters.JsonFormatter)
};
}

}

人气教程排行