我見過以兩種不同方式從webapi方法返回的viewmodels。有什麼區別,哪些是標準?從webapi返回HttpResponseMessage和直接viewmodels有什麼區別?
[HttpGet]
public List<UserViewModel> Get()
{
//stuff here
return usersViewModels;
}
[HttpGet]
public HttpResponseMessage Get()
{
//stuff here
return Request.CreateResponse(HttpStatusCode.OK, usersViewModels);
}