public IHttpActionResult PutProgrammeDiscipline(int id, ProgrammeDiscipline programmeDiscipline) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != programmeDiscipline.Id) { return(BadRequest()); } db.Entry(programmeDiscipline).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProgrammeDisciplineExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetProgrammeDiscipline(int id) { ProgrammeDiscipline programmeDiscipline = db.ProgrammeDisciplines.Find(id); if (programmeDiscipline == null) { return(NotFound()); } return(Ok(programmeDiscipline)); }
public IHttpActionResult PostProgrammeDiscipline(ProgrammeDiscipline programmeDiscipline) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ProgrammeDisciplines.Add(programmeDiscipline); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = programmeDiscipline.Id }, programmeDiscipline)); }
public IHttpActionResult DeleteProgrammeDiscipline(int id) { ProgrammeDiscipline programmeDiscipline = db.ProgrammeDisciplines.Find(id); if (programmeDiscipline == null) { return(NotFound()); } db.ProgrammeDisciplines.Remove(programmeDiscipline); db.SaveChanges(); return(Ok(programmeDiscipline)); }