public IHttpActionResult Putsurveycas(int id, surveycas surveycas) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != surveycas.ID) { return(BadRequest()); } db.Entry(surveycas).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!surveycasExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getsurveycas(int id) { surveycas surveycas = db.surveycases.Find(id); if (surveycas == null) { return(NotFound()); } return(Ok(surveycas)); }
public IHttpActionResult Postsurveycas(surveycas surveycas) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.surveycases.Add(surveycas); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = surveycas.ID }, surveycas)); }
public IHttpActionResult Deletesurveycas(int id) { surveycas surveycas = db.surveycases.Find(id); if (surveycas == null) { return(NotFound()); } db.surveycases.Remove(surveycas); db.SaveChanges(); return(Ok(surveycas)); }