public IHttpActionResult PutSPOInfo(int id, SPOInfo sPOInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != sPOInfo.SPOInfoId) { return(BadRequest()); } db.Entry(sPOInfo).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SPOInfoExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetSPOInfo(int id) { SPOInfo sPOInfo = db.SPOInfoset.Find(id); if (sPOInfo == null) { return(NotFound()); } return(Ok(sPOInfo)); }
public IHttpActionResult PostSPOInfo(SPOInfo sPOInfo) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.SPOInfoset.Add(sPOInfo); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = sPOInfo.SPOInfoId }, sPOInfo)); }
public IHttpActionResult DeleteSPOInfo(int id) { SPOInfo sPOInfo = db.SPOInfoset.Find(id); if (sPOInfo == null) { return(NotFound()); } db.SPOInfoset.Remove(sPOInfo); db.SaveChanges(); return(Ok(sPOInfo)); }