public async Task <IActionResult> PutStatesTable(byte id, StatesTable statesTable) { if (id != statesTable.StateId) { return(BadRequest()); } _context.Entry(statesTable).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StatesTableExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <StatesTable> > PostStatesTable(StatesTable statesTable) { _context.StatesTable.Add(statesTable); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (StatesTableExists(statesTable.StateId)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetStatesTable", new { id = statesTable.StateId }, statesTable)); }