public async Task <ActionResult <Griptape> > PostGriptape(Griptape griptape) { _context.GripTape.Add(griptape); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGriptape", new { id = griptape.Id }, griptape)); }
public async Task <IActionResult> PutGriptape(int id, Griptape griptape) { if (id != griptape.Id) { return(BadRequest()); } _context.Entry(griptape).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!GriptapeExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }