public IHttpActionResult Putsurveyarea(int id, surveyarea surveyarea) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != surveyarea.ID) { return(BadRequest()); } db.Entry(surveyarea).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!surveyareaExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Getsurveyarea(int id) { surveyarea surveyarea = db.surveyareas.Find(id); if (surveyarea == null) { return(NotFound()); } return(Ok(surveyarea)); }
public IHttpActionResult Postsurveyarea(surveyarea surveyarea) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.surveyareas.Add(surveyarea); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = surveyarea.ID }, surveyarea)); }
public IHttpActionResult Deletesurveyarea(int id) { surveyarea surveyarea = db.surveyareas.Find(id); if (surveyarea == null) { return(NotFound()); } db.surveyareas.Remove(surveyarea); db.SaveChanges(); return(Ok(surveyarea)); }