public IHttpActionResult PostTeachersComing(TeachersComing teachersComing) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TeachersComings.Add(teachersComing); try { db.SaveChanges(); } catch (DbUpdateException) { if (TeachersComingExists(teachersComing.TeachersAreComingFrom)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = teachersComing.TeachersAreComingFrom }, teachersComing)); }
public IHttpActionResult PutTeachersComing(string id, TeachersComing teachersComing) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != teachersComing.TeachersAreComingFrom) { return(BadRequest()); } db.Entry(teachersComing).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TeachersComingExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTeachersComing(string id) { TeachersComing teachersComing = db.TeachersComings.Find(id); if (teachersComing == null) { return(NotFound()); } return(Ok(teachersComing)); }
public IHttpActionResult DeleteTeachersComing(string id) { TeachersComing teachersComing = db.TeachersComings.Find(id); if (teachersComing == null) { return(NotFound()); } db.TeachersComings.Remove(teachersComing); db.SaveChanges(); return(Ok(teachersComing)); }