public IHttpActionResult PutExercise_Type(int id, Exercise_Type exercise_Type) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != exercise_Type.Exercise_Type_ID) { return(BadRequest()); } db.Entry(exercise_Type).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Exercise_TypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetExercise_Type(int id) { Exercise_Type exercise_Type = db.Exercise_Type.Find(id); if (exercise_Type == null) { return(NotFound()); } return(Ok(exercise_Type)); }
public IHttpActionResult PostExercise_Type(Exercise_Type exercise_Type) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Exercise_Type.Add(exercise_Type); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = exercise_Type.Exercise_Type_ID }, exercise_Type)); }
public IHttpActionResult DeleteExercise_Type(int id) { Exercise_Type exercise_Type = db.Exercise_Type.Find(id); if (exercise_Type == null) { return(NotFound()); } db.Exercise_Type.Remove(exercise_Type); db.SaveChanges(); return(Ok(exercise_Type)); }