Òþ²Ø´úÂë
public class CustomersController : ApiController { private ApplicationDbContext db = new ApplicationDbContext(); // GET: api/Customers public IQueryable<Customer> GetCustomers() { return db.Customers; } // GET: api/Customers/5 [ResponseType(typeof(Customer))] public async Task<IHttpActionResult> GetCustomer(int id) { Customer customer = await db.Customers.FindAsync(id); if (customer == null) { return NotFound(); } return Ok(customer); } // PUT: api/Customers/5 [Authorize] [ResponseType(typeof(void))] public async Task<IHttpActionResult> PutCustomer(int id, Customer customer) { // ... } // POST: api/Customers [Authorize] [ResponseType(typeof(Customer))] public async Task<IHttpActionResult> PostCustomer(Customer customer) { // ... } // DELETE: api/Customers/5 [ResponseType(typeof(Customer))] [Authorize] public async Task<IHttpActionResult> DeleteCustomer(int id) { // ... } } ÈÃWeb APIÒÔCamelCaseÊä³öJSON
¡¡