コード例 #1
0
        public async Task <IHttpActionResult> Posttbl_DTCTVARIANT(tbl_DTCTVARIANT tbl_DTCTVARIANT)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tbl_DTCTVARIANT.Add(tbl_DTCTVARIANT);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (tbl_DTCTVARIANTExists(tbl_DTCTVARIANT.va_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tbl_DTCTVARIANT.va_id }, tbl_DTCTVARIANT));
        }
コード例 #2
0
        public async Task <IHttpActionResult> Puttbl_DTCTVARIANT(string id, tbl_DTCTVARIANT tbl_DTCTVARIANT)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tbl_DTCTVARIANT.va_id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #3
0
        public async Task <IHttpActionResult> Gettbl_DTCTVARIANT(string id)
        {
            tbl_DTCTVARIANT tbl_DTCTVARIANT = await db.tbl_DTCTVARIANT.FindAsync(id);

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

            return(Ok(tbl_DTCTVARIANT));
        }
コード例 #4
0
        public async Task <IHttpActionResult> Deletetbl_DTCTVARIANT(string id)
        {
            tbl_DTCTVARIANT tbl_DTCTVARIANT = await db.tbl_DTCTVARIANT.FindAsync(id);

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

            db.tbl_DTCTVARIANT.Remove(tbl_DTCTVARIANT);
            await db.SaveChangesAsync();

            return(Ok(tbl_DTCTVARIANT));
        }