コード例 #1
0
        // POST: odata/msPanelArgTypes
        public async Task <IHttpActionResult> Post(msPanelArgType msPanelArgType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.msPanelArgTypes.Add(msPanelArgType);
            await db.SaveChangesAsync();

            return(Created(msPanelArgType));
        }
コード例 #2
0
        // DELETE: odata/msPanelArgTypes(5)
        public async Task <IHttpActionResult> Delete([FromODataUri] int key)
        {
            msPanelArgType msPanelArgType = await db.msPanelArgTypes.FindAsync(key);

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

            db.msPanelArgTypes.Remove(msPanelArgType);
            await db.SaveChangesAsync();

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        // PUT: odata/msPanelArgTypes(5)
        public async Task <IHttpActionResult> Put([FromODataUri] int key, Delta <msPanelArgType> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            msPanelArgType msPanelArgType = await db.msPanelArgTypes.FindAsync(key);

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

            patch.Put(msPanelArgType);

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

            return(Updated(msPanelArgType));
        }