public IHttpActionResult PutTestClassEntry(int id, TestClassEntry testClassEntry) { //if (!ModelState.IsValid) //{ // return BadRequest(ModelState); //} if (id != testClassEntry.id) { return(BadRequest()); } db.Entry(testClassEntry).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TestClassEntryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostTestClassEntry(TestClassEntry testClassEntry) { db.TestClassEntries.Add(testClassEntry); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = testClassEntry.id }, testClassEntry)); }
public IHttpActionResult GetTestClassEntry(int id) { TestClassEntry testClassEntry = db.TestClassEntries.Find(id); if (testClassEntry == null) { return(NotFound()); } return(Ok(testClassEntry)); }
public IHttpActionResult DeleteTestClassEntry(int id) { TestClassEntry testClassEntry = db.TestClassEntries.Find(id); if (testClassEntry == null) { return(NotFound()); } db.TestClassEntries.Remove(testClassEntry); db.SaveChanges(); return(Ok(testClassEntry)); }