public IHttpActionResult PutRichting(int id, Richting richting) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != richting.RichtingId) { return BadRequest(); } db.Entry(richting).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RichtingExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostRichting(Richting richting) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.Richtings.Add(richting); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = richting.RichtingId }, richting); }