public IHttpActionResult Putusers_type(int id, users_type users_type) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != users_type.id_users_type) { return(BadRequest()); } db.Entry(users_type).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!users_typeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getusers_type(int id) { users_type users_type = db.users_type.Find(id); if (users_type == null) { return(NotFound()); } return(Ok(users_type)); }
public IHttpActionResult Postusers_type(users_type users_type) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.users_type.Add(users_type); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = users_type.id_users_type }, users_type)); }
public IHttpActionResult Deleteusers_type(int id) { users_type users_type = db.users_type.Find(id); if (users_type == null) { return(NotFound()); } db.users_type.Remove(users_type); db.SaveChanges(); return(Ok(users_type)); }