public IHttpActionResult PostC7602Customer(C7602Customer c7602Customer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.C7602Customer.Add(c7602Customer); try { db.SaveChanges(); } catch (DbUpdateException) { if (C7602CustomerExists(c7602Customer.CustomerNumber)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = c7602Customer.CustomerNumber }, c7602Customer)); }
public IHttpActionResult PutC7602Customer(int id, C7602Customer c7602Customer) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != c7602Customer.CustomerNumber) { return(BadRequest()); } db.Entry(c7602Customer).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!C7602CustomerExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetC7602Customer(int id) { C7602Customer c7602Customer = db.C7602Customer.Find(id); if (c7602Customer == null) { return(NotFound()); } return(Ok(c7602Customer)); }
public IHttpActionResult DeleteC7602Customer(int id) { C7602Customer c7602Customer = db.C7602Customer.Find(id); if (c7602Customer == null) { return(NotFound()); } db.C7602Customer.Remove(c7602Customer); db.SaveChanges(); return(Ok(c7602Customer)); }