public IHttpActionResult PostTYPE_STUDENT(TYPE_STUDENT tYPE_STUDENT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TYPE_STUDENT.Add(tYPE_STUDENT); try { db.SaveChanges(); } catch (DbUpdateException) { if (TYPE_STUDENTExists(tYPE_STUDENT.STUTYPE_ID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = tYPE_STUDENT.STUTYPE_ID }, tYPE_STUDENT)); }
public IHttpActionResult PutTYPE_STUDENT(int id, TYPE_STUDENT tYPE_STUDENT) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tYPE_STUDENT.STUTYPE_ID) { return(BadRequest()); } db.Entry(tYPE_STUDENT).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TYPE_STUDENTExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTYPE_STUDENT(int id) { TYPE_STUDENT tYPE_STUDENT = db.TYPE_STUDENT.Find(id); if (tYPE_STUDENT == null) { return(NotFound()); } return(Ok(tYPE_STUDENT)); }
public IHttpActionResult DeleteTYPE_STUDENT(int id) { TYPE_STUDENT tYPE_STUDENT = db.TYPE_STUDENT.Find(id); if (tYPE_STUDENT == null) { return(NotFound()); } db.TYPE_STUDENT.Remove(tYPE_STUDENT); db.SaveChanges(); return(Ok(tYPE_STUDENT)); }