// POST: odata/tbl_Party public IHttpActionResult Post(tbl_Party tbl_Party) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tbl_Party.Add(tbl_Party); try { db.SaveChanges(); } catch (DbUpdateException) { if (tbl_PartyExists(tbl_Party.PartyNameID)) { return(Conflict()); } else { throw; } } return(Created(tbl_Party)); }
// DELETE: odata/tbl_Party(5) public IHttpActionResult Delete([FromODataUri] int key) { tbl_Party tbl_Party = db.tbl_Party.Find(key); if (tbl_Party == null) { return(NotFound()); } db.tbl_Party.Remove(tbl_Party); db.SaveChanges(); return(StatusCode(HttpStatusCode.NoContent)); }
// PUT: odata/tbl_Party(5) public IHttpActionResult Put([FromODataUri] int key, Delta <tbl_Party> patch) { Validate(patch.GetEntity()); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } tbl_Party tbl_Party = db.tbl_Party.Find(key); if (tbl_Party == null) { return(NotFound()); } patch.Put(tbl_Party); try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!tbl_PartyExists(key)) { return(NotFound()); } else { throw; } } return(Updated(tbl_Party)); }