Esempio n. 1
0
        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));
        }
Esempio n. 2
0
        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));
        }
Esempio n. 3
0
        public IHttpActionResult GetLocTrackMain(int id)
        {
            LocTrackMain locTrackMain = db.LocTrackMains.Find(id);

            if (locTrackMain == null)
            {
                return(NotFound());
            }

            return(Ok(locTrackMain));
        }
Esempio n. 4
0
        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));
        }