public async Task <IActionResult> PutTannotation(short id, Tannotation tannotation) { if (id != tannotation.TannotationId) { return(BadRequest()); } _context.Entry(tannotation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TannotationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Tannotation> > PostTannotation(Tannotation tannotation) { _context.Tannotation.Add(tannotation); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (TannotationExists(tannotation.TannotationId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetTannotation", new { id = tannotation.TannotationId }, tannotation)); }