public IHttpActionResult PutCustomers(long id, Customers customers) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != customers.Id) { return BadRequest(); } db.Entry(customers).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CustomersExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostCustomers(Customers customers) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Customers.Add(customers); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = customers.Id }, customers); }