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

            db.PUR070.Add(pUR070);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (PUR070Exists(pUR070.PUR07_NO))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

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

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

            db.PUR070.Remove(pUR070);
            await db.SaveChangesAsync();

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

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

            PUR070 pUR070 = await db.PUR070.FindAsync(key);

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

            patch.Put(pUR070);

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

            return(Updated(pUR070));
        }