public IHttpActionResult Putprogramdevicemodel(int id, programdevicemodel programdevicemodel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != programdevicemodel.ID) { return(BadRequest()); } db.Entry(programdevicemodel).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!programdevicemodelExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getprogramdevicemodel(int id) { programdevicemodel programdevicemodel = db.programdevicemodels.Find(id); if (programdevicemodel == null) { return(NotFound()); } return(Ok(programdevicemodel)); }
public IHttpActionResult Postprogramdevicemodel(programdevicemodel programdevicemodel) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.programdevicemodels.Add(programdevicemodel); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = programdevicemodel.ID }, programdevicemodel)); }
public IHttpActionResult Deleteprogramdevicemodel(int id) { programdevicemodel programdevicemodel = db.programdevicemodels.Find(id); if (programdevicemodel == null) { return(NotFound()); } db.programdevicemodels.Remove(programdevicemodel); db.SaveChanges(); return(Ok(programdevicemodel)); }