public async Task <IHttpActionResult> Putusers_profile(int id, users_profile users_profile) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != users_profile.id) { return(BadRequest()); } db.Entry(users_profile).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!users_profileExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> Getusers_profile(int id) { users_profile users_profile = await db.users_profile.FindAsync(id); if (users_profile == null) { return(NotFound()); } return(Ok(users_profile)); }
public async Task <IHttpActionResult> Postusers_profile(users_profile users_profile) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.users_profile.Add(users_profile); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = users_profile.id }, users_profile)); }
public async Task <IHttpActionResult> Deleteusers_profile(int id) { users_profile users_profile = await db.users_profile.FindAsync(id); if (users_profile == null) { return(NotFound()); } db.users_profile.Remove(users_profile); await db.SaveChangesAsync(); return(Ok(users_profile)); }