public IHttpActionResult PutVstdoModel(int id, VstdoModel vstdoModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != vstdoModel.KeyID) { return(BadRequest()); } db.Entry(vstdoModel).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!VstdoModelExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetVstdoModel(int id) { VstdoModel vstdoModel = db.ToDoes.Find(id); if (vstdoModel == null) { return(NotFound()); } return(Ok(vstdoModel)); }
public IHttpActionResult PostVstdoModel(VstdoModel vstdoModel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ToDoes.Add(vstdoModel); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = vstdoModel.KeyID }, vstdoModel)); }
public IHttpActionResult DeleteVstdoModel(int id) { VstdoModel vstdoModel = db.ToDoes.Find(id); if (vstdoModel == null) { return(NotFound()); } db.ToDoes.Remove(vstdoModel); db.SaveChanges(); return(Ok(vstdoModel)); }