public IHttpActionResult Put(int id, DGeometry dGeometry) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dGeometry.deviation_id) { return(BadRequest()); } db.Entry(dGeometry).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DGeometryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Get(int id) { DGeometry dGeometry = db.DGeometries.Find(id); if (dGeometry == null) { return(NotFound()); } return(Ok(dGeometry)); }
public IHttpActionResult Post(DGeometry dGeometry) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DGeometries.Add(dGeometry); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = dGeometry.deviation_id }, dGeometry)); }
public IHttpActionResult Delete(int id) { DGeometry dGeometry = db.DGeometries.Find(id); if (dGeometry == null) { return(NotFound()); } db.DGeometries.Remove(dGeometry); db.SaveChanges(); return(Ok(dGeometry)); }