, Visual Studio (2013) "-" "mvc". - , .
, , - MVC- , angularJS, WebAPI RESTful ajax.
angularJS -. : . WebAPI, WebAPI ( ), HTTP VERBS CRUD. :
public HttpResponseMessage Get()
{
return this.Request.CreateResponse(HttpStatusCode.OK, this.repository.GetAllCustomers());
}
public HttpResponseMessage Post(Customer customer)
{
var modifiedCustomer = this.repository.Update(customer);
this.repository.SaveChanges();
return this.Request.CreateResponse(HttpStatusCode.OK, modifiedCustomer);
}
. , JSON XML: WebAPI HTTP-HEADERS WebAPI . JSON, , , , JSON-. , JSON, - JSON.NET .
AngularJS URL- , $save, $query, $get .., . :
var customerRes = $resource('/customers');
var currentCustomers = customerRes.query(function(){
currentCustomers[0].email = "foo@baz.bar";
currentCustomers[0].$save();
});
.