Example #1
0
        public async Task <IHttpActionResult> PostDoubleThrustAngContactBallBrg(DoubleThrustAngContactBallBrg doubleThrustAngContactBallBrg)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DoubleThrustAngContactBallBearings.Add(doubleThrustAngContactBallBrg);

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

            return(CreatedAtRoute("DefaultApi", new { id = doubleThrustAngContactBallBrg.TypeID }, doubleThrustAngContactBallBrg));
        }
Example #2
0
        public async Task <IHttpActionResult> GetDoubleThrustAngContactBallBrg(string id)
        {
            DoubleThrustAngContactBallBrg doubleThrustAngContactBallBrg = await db.DoubleThrustAngContactBallBearings.FindAsync(id);

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

            return(Ok(doubleThrustAngContactBallBrg));
        }
Example #3
0
        public async Task <IHttpActionResult> DeleteDoubleThrustAngContactBallBrg(string id)
        {
            DoubleThrustAngContactBallBrg doubleThrustAngContactBallBrg = await db.DoubleThrustAngContactBallBearings.FindAsync(id);

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

            db.DoubleThrustAngContactBallBearings.Remove(doubleThrustAngContactBallBrg);
            await db.SaveChangesAsync();

            return(Ok(doubleThrustAngContactBallBrg));
        }
Example #4
0
        public async Task <IHttpActionResult> PutDoubleThrustAngContactBallBrg(string id, DoubleThrustAngContactBallBrg doubleThrustAngContactBallBrg)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }