public IHttpActionResult PostPestCode_LU(PestCode_LU pestCode_LU) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PestCode_LU.Add(pestCode_LU); try { db.SaveChanges(); } catch (DbUpdateException) { if (PestCode_LUExists(pestCode_LU.PESTCODE)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = pestCode_LU.PESTCODE }, pestCode_LU)); }
public IHttpActionResult PutPestCode_LU(string id, PestCode_LU pestCode_LU) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pestCode_LU.PESTCODE) { return(BadRequest()); } db.Entry(pestCode_LU).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PestCode_LUExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetPestCode_LU(string id) { PestCode_LU pestCode_LU = db.PestCode_LU.Find(id); if (pestCode_LU == null) { return(NotFound()); } return(Ok(pestCode_LU)); }
public IHttpActionResult DeletePestCode_LU(string id) { PestCode_LU pestCode_LU = db.PestCode_LU.Find(id); if (pestCode_LU == null) { return(NotFound()); } db.PestCode_LU.Remove(pestCode_LU); db.SaveChanges(); return(Ok(pestCode_LU)); }