public IHttpActionResult PutLocTrackMain(int id, LocTrackMain locTrackMain) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != locTrackMain.poll_Id) { return(BadRequest()); } db.Entry(locTrackMain).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LocTrackMainExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostLocTrackMain(LocTrackMain locTrackMain) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LocTrackMains.Add(locTrackMain); try { db.SaveChanges(); } catch (DbUpdateException) { if (LocTrackMainExists(locTrackMain.poll_Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = locTrackMain.poll_Id }, locTrackMain)); }
public IHttpActionResult GetLocTrackMain(int id) { LocTrackMain locTrackMain = db.LocTrackMains.Find(id); if (locTrackMain == null) { return(NotFound()); } return(Ok(locTrackMain)); }
public IHttpActionResult DeleteLocTrackMain(int id) { LocTrackMain locTrackMain = db.LocTrackMains.Find(id); if (locTrackMain == null) { return(NotFound()); } db.LocTrackMains.Remove(locTrackMain); db.SaveChanges(); return(Ok(locTrackMain)); }