private void DeleteNearBy(NearBy nearBy)
        {
            DataServiceNearBy dsNear = new DataServiceNearBy();

            dsNear.DeleteNearBy(nearBy);
            NearByList.Remove(nearBy);
        }
コード例 #2
0
        public IHttpActionResult PutNearBy(int id, NearBy nearBy)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != nearBy.NearBys_id)
            {
                return(BadRequest());
            }

            db.Entry(nearBy).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NearByExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        private void AddNearBy()
        {
            DataServiceNearBy dsNear = new DataServiceNearBy();
            NearBy            nearBy = new NearBy();

            Tour.NearBy.Add(nearBy);
            nearBy.Tour = Tour;
            dsNear.addNearBy(nearBy);
            NearByList.Add(nearBy);
        }
コード例 #4
0
        public IHttpActionResult GetNearBy(int id)
        {
            NearBy nearBy = db.NearBys.Find(id);

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

            return(Ok(nearBy));
        }
コード例 #5
0
        public IHttpActionResult PostNearBy(NearBy nearBy)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.NearBys.Add(nearBy);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = nearBy.NearBys_id }, nearBy));
        }
コード例 #6
0
        public IHttpActionResult DeleteNearBy(int id)
        {
            NearBy nearBy = db.NearBys.Find(id);

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

            db.NearBys.Remove(nearBy);
            db.SaveChanges();

            return(Ok(nearBy));
        }
コード例 #7
0
 public void DeleteNearBy(NearBy nearBy)
 {
     nearBy.Tour.NearBy.Remove(nearBy);
     db.nearBy.DeleteOnSubmit(nearBy);
 }
コード例 #8
0
 public void addNearBy(NearBy newNearBy)
 {
     db.nearBy.InsertOnSubmit(newNearBy);
 }