0
我正在使用HotTowel处理单页应用程序。我在下面提到了使用breeze调用POST方法的链接。使用Breeze调用POST方法不起作用
http://www.breezejs.com/breeze-labs/breezeajaxpostjs
下面是我的代码。
在服务器端:
public struct Customer {
public string CompanyName{ get; set; }
public string Phone { get; set; }
}
[HttpPost]
public IQueryable<Customer> SimilarCustomersPOST(Customer customer)
{
return repository.CustomersLikeThis(customer);
}
使用微风调用POST方法。
var query = breeze.EntityQuery.from('SimilarCustomersPOST')
.withParameters({
$method: 'POST',
$encoding: 'JSON',
$data: { CompanyName: 'Hilo' , Phone: '808-234-5678' }
});
我得到以下错误: 错误:请求的资源不支持HTTP方法“GET”。
当我写类似下面的服务器代码:
[System.Web.Http.AcceptVerbs("GET", "POST")]
[HttpPost]
public IQueryable<Customer> SimilarCustomersPOST(Customer customer)
{
return repository.CustomersLikeThis(customer);
}
正在调用,但接受的参数越来越空值。
请让我知道我得到这个错误的原因是什么。
在此先感谢。