Example #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);
        }
Example #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);
        }