public async Task <IHttpActionResult> PutStageAttribute(int id, StageAttribute stageAttribute)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != stageAttribute.Id)
            {
                return(BadRequest());
            }

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

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StageAttributeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public void WriteAttributeLabel(StageAttribute a)
 {
     _b.Append('"');
     _b.Append('@');
     StringHandler.EscapeString(a.name, _b);
     _b.Append('"');
     _b.Append(':');
 }
예제 #3
0
 public void WriteAttributeLabel(StageAttribute a)
 {
     this._b.Append('\"');
     this._b.Append('@');
     StringHandler.EscapeString(a.name, this._b);
     this._b.Append('\"');
     this._b.Append(':');
 }
        public async Task <IHttpActionResult> GetStageAttribute(int id)
        {
            StageAttribute stageAttribute = await db.StageAttributes.FindAsync(id);

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

            return(Ok(stageAttribute));
        }
        public async Task <IHttpActionResult> PostStageAttribute(StageAttribute stageAttribute)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.StageAttributes.Add(stageAttribute);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = stageAttribute.Id }, stageAttribute));
        }
        public async Task <IHttpActionResult> DeleteStageAttribute(int id)
        {
            StageAttribute stageAttribute = await db.StageAttributes.FindAsync(id);

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

            db.StageAttributes.Remove(stageAttribute);
            await db.SaveChangesAsync();

            return(Ok(stageAttribute));
        }
예제 #7
0
        private void ParseValue(string name, bool isAttribute)
        {
            StageValue stageAttribute;

            this._valStart = this._idx;
            this._valEnd   = -1;
            while (this._idx < this._length)
            {
                char chr = this._s[this._idx];
                if (chr <= ' ')
                {
                    switch (chr)
                    {
                    case '\t':
                    case '\n':
                    case '\f':
                    case '\r':
                    {
                        if (this._valEnd != -1)
                        {
                            goto Label0;
                        }
                        this._valStart++;
                        goto Label0;
                    }

                    case '\v':
                    {
                        break;
                    }

                    default:
                    {
                        if (chr == ' ')
                        {
                            goto case '\r';
                        }
                        break;
                    }
                    }
                }
                else if (chr == ',' || chr == ']' || chr == '}')
                {
                    if (this._valEnd >= 0)
                    {
                        this._b.Append(this._s, this._valStart, this._valEnd - this._valStart + 1);
                    }
                    if (isAttribute)
                    {
                        stageAttribute = new StageAttribute(name, this._b.Flush(), false);
                    }
                    else
                    {
                        stageAttribute = new StageValue(name, this._b.Flush(), false);
                    }
                    this._curRoot.Add(stageAttribute);
                    this._idx--;
                    return;
                }
                this._valEnd = this._idx;
Label0:
                this._idx++;
            }
        }
예제 #8
0
        private void ParseItemType(string name, bool isAttribute)
        {
            StageValue stageAttribute;

            while (true)
            {
                if (this._idx >= this._length)
                {
                    return;
                }
                char chr = this._s[this._idx];
                if (chr > ' ')
                {
                    if (chr == '\"')
                    {
                        this._idx++;
                        this.ParseString();
                        if (isAttribute)
                        {
                            stageAttribute = new StageAttribute(name, this._b.Flush(), true);
                        }
                        else
                        {
                            stageAttribute = new StageValue(name, this._b.Flush(), true);
                        }
                        this._curRoot.Add(stageAttribute);
                        return;
                    }
                    if (chr == '[')
                    {
                        this._idx++;
                        this.ParseList(name);
                        return;
                    }
                    if (chr != '{')
                    {
                        break;
                    }
                    this._idx++;
                    this.ParseElement(name);
                    return;
                }
                else
                {
                    switch (chr)
                    {
                    case '\t':
                    case '\n':
                    case '\f':
                    case '\r':
                    {
                        this._idx++;
                        continue;
                    }

                    case '\v':
                    {
                        break;
                    }

                    default:
                    {
                        if (chr == ' ')
                        {
                            goto case '\r';
                        }
                        break;
                    }
                    }
                }
            }
            this.ParseValue(name, isAttribute);
        }