public async Task <short> PutStateRepository(int _id, State _state) { if (_id != _state.Id) { return(1); //bad request } _context.Entry(_state).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StateExists(_id)) { return(2); //not found } else { throw; } } return(3); //no content }