public IHttpActionResult PutSchemaKoppling(int id, SchemaKoppling schemaKoppling) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != schemaKoppling.Id) { return(BadRequest()); } db.Entry(schemaKoppling).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SchemaKopplingExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetSchemaKoppling(int id) { SchemaKoppling schemaKoppling = db.SchemaKoppling.Find(id); if (schemaKoppling == null) { return(NotFound()); } return(Ok(schemaKoppling)); }
public IHttpActionResult PostSchemaKoppling(SchemaKoppling schemaKoppling) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.SchemaKoppling.Add(schemaKoppling); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = schemaKoppling.Id }, schemaKoppling)); }
public IHttpActionResult DeleteSchemaKoppling(int id) { SchemaKoppling schemaKoppling = db.SchemaKoppling.Find(id); if (schemaKoppling == null) { return(NotFound()); } db.SchemaKoppling.Remove(schemaKoppling); db.SaveChanges(); return(Ok(schemaKoppling)); }