public IHttpActionResult PutWellProfile(int id, WellProfile wellProfile) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != wellProfile.ID) { return(BadRequest()); } db.Entry(wellProfile).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!WellProfileExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetWellProfile(int id) { WellProfile wellProfile = db.WellProfiles.Find(id); if (wellProfile == null) { return(NotFound()); } return(Ok(wellProfile)); }
public IHttpActionResult GetWellProfile(string code) { WellProfile wellProfile = db.WellProfiles.Where(a => a.Index == code).FirstOrDefault(); if (wellProfile == null) { return(NotFound()); } return(Ok(wellProfile)); }
public IHttpActionResult GetWellProfile(int id) { WellProfile wellProfile = db.WellProfiles.Find(id);//.Include(a => a.City).Include(a => a.StudyArea).Include(a => a.Plain); if (wellProfile == null) { return(NotFound()); } return(Ok(wellProfile)); }
public IHttpActionResult PostWellProfile(WellProfile wellProfile) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.WellProfiles.Add(wellProfile); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = wellProfile.ID }, wellProfile)); }
public IHttpActionResult DeleteWellProfile(int id) { WellProfile wellProfile = db.WellProfiles.Find(id); if (wellProfile == null) { return(NotFound()); } db.WellProfiles.Remove(wellProfile); db.SaveChanges(); return(Ok(wellProfile)); }