public IHttpActionResult PutTDoDB(int id, TDoDB tDoDB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != tDoDB.TaskId) { return(BadRequest()); } db.Entry(tDoDB).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!TDoDBExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTDoDB(int id) { TDoDB tDoDB = db.TDoDB.Find(id); if (tDoDB == null) { return(NotFound()); } return(Ok(tDoDB)); }
public IHttpActionResult PostTDoDB(TDoDB tDoDB) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.TDoDB.Add(tDoDB); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = tDoDB.TaskId }, tDoDB)); }
public IHttpActionResult DeleteTDoDB(int id) { TDoDB tDoDB = db.TDoDB.Find(id); if (tDoDB == null) { return(NotFound()); } db.TDoDB.Remove(tDoDB); db.SaveChanges(); return(Ok(tDoDB)); }