public IHttpActionResult PutUsers(decimal id, TEST_USERS test_users) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != test_users.ID) { return BadRequest(); } db.Entry(test_users).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UserExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public IHttpActionResult PostUser(TEST_USERS tEST_USERS) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.TEST_USERS.Add(tEST_USERS); try { db.SaveChanges(); } catch (DbUpdateException) { if (UserExists(tEST_USERS.ID)) { return Conflict(); } else { throw; } } return CreatedAtRoute("DefaultApi", new { id = tEST_USERS.ID }, tEST_USERS); }