public async Task <ActionResult <Courthouse> > PostCourthouse(Courthouse courthouse) { _context.Courthouses.Add(courthouse); await _context.SaveChangesAsync(); return(CreatedAtAction("GetCourthouse", new { id = courthouse.Id }, courthouse)); }
public async Task <IActionResult> PutCourthouse(int id, Courthouse courthouse) { if (id != courthouse.Id) { return(BadRequest()); } _context.Entry(courthouse).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CourthouseExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }