public IHttpActionResult PuttestInformation(int id, testInformation testInformation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != testInformation.id) { return(BadRequest()); } db.Entry(testInformation).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!testInformationExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GettestInformation(int id) { testInformation testInformation = db.testInformation.Find(id); if (testInformation == null) { return(NotFound()); } return(Ok(testInformation)); }
public async Task <IHttpActionResult> GettestInformation(int id) { testInformation testInformation = await db.testInformation.FindAsync(id); if (testInformation == null) { return(NotFound()); } return(Ok(testInformation)); }
public IHttpActionResult PosttestInformation(testInformation testInformation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.testInformation.Add(testInformation); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = testInformation.id }, testInformation)); }
public IHttpActionResult DeletetestInformation(int id) { testInformation testInformation = db.testInformation.Find(id); if (testInformation == null) { return(NotFound()); } db.testInformation.Remove(testInformation); db.SaveChanges(); return(Ok(testInformation)); }
public async Task <IHttpActionResult> DeletetestInformation(int id) { testInformation testInformation = await db.testInformation.FindAsync(id); if (testInformation == null) { return(NotFound()); } db.testInformation.Remove(testInformation); await db.SaveChangesAsync(); return(Ok(testInformation)); }
public async Task CreateInfo([FromBody] testInformation info) { await informationServicecs.AddInfoAsync(info); }
public async Task AddInfoAsync(testInformation info) { await Task.Run(() => db.testInformation.Add(info)); await db.SaveChangesAsync(); }