public IHttpActionResult PostG1_N1_Class(G1_N1_Class g1_N1_Class) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.G1_N1_Class.Add(g1_N1_Class); try { db.SaveChanges(); } catch (DbUpdateException) { if (G1_N1_ClassExists(g1_N1_Class.TeacherID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = g1_N1_Class.TeacherID }, g1_N1_Class)); }
public IHttpActionResult PutG1_N1_Class(int id, G1_N1_Class g1_N1_Class) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != g1_N1_Class.TeacherID) { return(BadRequest()); } db.Entry(g1_N1_Class).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!G1_N1_ClassExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetG1_N1_Class(int id) { G1_N1_Class g1_N1_Class = db.G1_N1_Class.Find(id); if (g1_N1_Class == null) { return(NotFound()); } return(Ok(g1_N1_Class)); }
public IHttpActionResult DeleteG1_N1_Class(int id) { G1_N1_Class g1_N1_Class = db.G1_N1_Class.Find(id); if (g1_N1_Class == null) { return(NotFound()); } db.G1_N1_Class.Remove(g1_N1_Class); db.SaveChanges(); return(Ok(g1_N1_Class)); }