public async Task <IHttpActionResult> Put([FromODataUri] int key, Klassenliste update) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (key != update.Id) { return(BadRequest()); } db.Entry(update).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!KlassenlisteExists(key)) { return(NotFound()); } else { throw; } } return(Updated(update)); }
public async Task <IHttpActionResult> Post(Klassenliste Klassenliste) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Klassenlistes.Add(Klassenliste); await db.SaveChangesAsync(); return(Created(Klassenliste)); }