public IHttpActionResult PutAtelie(int id, Atelie atelie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != atelie.atelieID) { return(BadRequest()); } db.Entry(atelie).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AtelieExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostAtelie(Atelie atelie) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Atelie.Add(atelie); try { db.SaveChanges(); } catch (DbUpdateException) { if (AtelieExists(atelie.atelieID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = atelie.atelieID }, atelie)); }
public IHttpActionResult DeleteAtelie(int id) { Atelie atelie = db.Atelie.Find(id); if (atelie == null) { return(NotFound()); } db.Atelie.Remove(atelie); db.SaveChanges(); return(Ok(atelie)); }