public IHttpActionResult PostCustomer_View(Customer_View customer_View) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Customer_View.Add(customer_View); try { db.SaveChanges(); } catch (DbUpdateException) { if (Customer_ViewExists(customer_View.Id)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = customer_View.Id }, customer_View); }
public IHttpActionResult PutCustomer_View(int id, Customer_View customer_View) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != customer_View.Id) { return BadRequest(); } db.Entry(customer_View).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Customer_ViewExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }