Example #1
0
        public IHttpActionResult Post(ETransitionGeometryInput eTransitionGeometryInput)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ETransitionGeometryInputs.Add(eTransitionGeometryInput);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ETransitionGeometryInputExists(eTransitionGeometryInput.transition_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = eTransitionGeometryInput.transition_id }, eTransitionGeometryInput));
        }
Example #2
0
        public IHttpActionResult Put(int id, ETransitionGeometryInput eTransitionGeometryInput)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != eTransitionGeometryInput.transition_id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #3
0
        public IHttpActionResult Get(int id)
        {
            ETransitionGeometryInput eTransitionGeometryInput = db.ETransitionGeometryInputs.Find(id);

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

            return(Ok(eTransitionGeometryInput));
        }
Example #4
0
        public IHttpActionResult Delete(int id)
        {
            ETransitionGeometryInput eTransitionGeometryInput = db.ETransitionGeometryInputs.Find(id);

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

            db.ETransitionGeometryInputs.Remove(eTransitionGeometryInput);
            db.SaveChanges();

            return(Ok(eTransitionGeometryInput));
        }