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)); }
public IHttpActionResult GetUser(decimal id) { TEST_USERS tEST_USERS = db.TEST_USERS.Find(id); if (tEST_USERS == null) { return(NotFound()); } return(Ok(tEST_USERS)); }
public IHttpActionResult DeleteUser(decimal id) { TEST_USERS tEST_USERS = db.TEST_USERS.Find(id); if (tEST_USERS == null) { return(NotFound()); } db.TEST_USERS.Remove(tEST_USERS); db.SaveChanges(); return(Ok(tEST_USERS)); }