Example #1
0
        public async Task <IActionResult> PostDoubleRowCylinRollerBrg([FromBody] DoubleRowCylinRollerBrg doubleRowCylinRollerBrg)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.DoubleRowCylinRollerBearings.Add(doubleRowCylinRollerBrg);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (DoubleRowCylinRollerBrgExists(doubleRowCylinRollerBrg.TypeID))
                {
                    return(StatusCode((int)HttpStatusCode.Conflict));
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = doubleRowCylinRollerBrg.TypeID }, doubleRowCylinRollerBrg));
        }
Example #2
0
        public async Task <IActionResult> PutDoubleRowCylinRollerBrg(string id, [FromBody] DoubleRowCylinRollerBrg doubleRowCylinRollerBrg)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode((int)HttpStatusCode.NoContent));
        }
Example #3
0
        public async Task<IHttpActionResult> PostDoubleRowCylinRollerBrg(DoubleRowCylinRollerBrg doubleRowCylinRollerBrg)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            db.DoubleRowCylinRollerBearings.Add(doubleRowCylinRollerBrg);

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

            return CreatedAtRoute("DefaultApi", new { id = doubleRowCylinRollerBrg.TypeID }, doubleRowCylinRollerBrg);
        }
Example #4
0
        public async Task<IHttpActionResult> PutDoubleRowCylinRollerBrg(string id, DoubleRowCylinRollerBrg doubleRowCylinRollerBrg)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

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

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

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

            return StatusCode(HttpStatusCode.NoContent);
        }
Example #5
0
        public async Task <IActionResult> GetDoubleRowCylinRollerBrg(string id)
        {
            DoubleRowCylinRollerBrg doubleRowCylinRollerBrg = await db.DoubleRowCylinRollerBearings.FindAsync(id);

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

            return(Ok(doubleRowCylinRollerBrg));
        }
Example #6
0
        public async Task <IActionResult> DeleteDoubleRowCylinRollerBrg(string id)
        {
            DoubleRowCylinRollerBrg doubleRowCylinRollerBrg = await db.DoubleRowCylinRollerBearings.FindAsync(id);

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

            db.DoubleRowCylinRollerBearings.Remove(doubleRowCylinRollerBrg);
            await db.SaveChangesAsync();

            return(Ok(doubleRowCylinRollerBrg));
        }