public IHttpActionResult Putcompdetail(int id, compdetail compdetail) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != compdetail.compid) { return(BadRequest()); } db.Entry(compdetail).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!compdetailExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Deletecompdetail(int id) { compdetail compdetail = db.compdetails.Find(id); if (compdetail == null) { return(NotFound()); } db.compdetails.Remove(compdetail); db.SaveChanges(); return(Ok(compdetail)); }
public IHttpActionResult Postcompdetail(compdetail cmpdtl) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } // db.compdetails.Add(compdetail); //db.SaveChanges(); var emp = db.insert(cmpdtl.empid, cmpdtl.dept, cmpdtl.problem, cmpdtl.status, cmpdtl.contact, cmpdtl.date); return(CreatedAtRoute("DefaultApi", new { id = cmpdtl.compid }, cmpdtl)); }