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