public IHttpActionResult Puteligible_green(int id, eligible_green eligible_green) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eligible_green.id) { return(BadRequest()); } db.Entry(eligible_green).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!eligible_greenExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Geteligible_green(int id) { eligible_green eligible_green = db.eligible_green.Find(id); if (eligible_green == null) { return(NotFound()); } return(Ok(eligible_green)); }
public IHttpActionResult Posteligible_green(eligible_green eligible_green) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.eligible_green.Add(eligible_green); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = eligible_green.id }, eligible_green)); }
public IHttpActionResult Deleteeligible_green(int id) { eligible_green eligible_green = db.eligible_green.Find(id); if (eligible_green == null) { return(NotFound()); } db.eligible_green.Remove(eligible_green); db.SaveChanges(); return(Ok(eligible_green)); }