// POST: odata/CustomerPerson public async Task <IHttpActionResult> Post(customer_person customer_person) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.customer_person.Add(customer_person); try { await db.SaveChangesAsync(); } catch (DbUpdateException) { if (customer_personExists(customer_person.customer_person_id)) { return(Conflict()); } else { throw; } } return(Created(customer_person)); }
// DELETE: odata/CustomerPerson(5) public async Task <IHttpActionResult> Delete([FromODataUri] int key) { customer_person customer_person = await db.customer_person.FindAsync(key); if (customer_person == null) { return(NotFound()); } db.customer_person.Remove(customer_person); await db.SaveChangesAsync(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/CustomerPerson(5) public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <customer_person> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } customer_person customer_person = await db.customer_person.FindAsync(key); if (customer_person == null) { return(NotFound()); } patch.Put(customer_person); try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!customer_personExists(key)) { return(NotFound()); } else { throw; } } return(Updated(customer_person)); }