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

            db.AlignBallBearings.Add(alignBallBrg);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (AlignBallBrgExists(alignBallBrg.TypeID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

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

            if (id != alignBallBrg.TypeID)
            {
                return(BadRequest());
            }

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

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

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

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

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

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

            db.AlignBallBearings.Remove(alignBallBrg);
            await db.SaveChangesAsync();

            return(Ok(alignBallBrg));
        }