public async Task <IActionResult> PostSpindleBeltSize([FromBody] SpindleBeltSize spindleBeltSize)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.SpindleBeltSizes.Add(spindleBeltSize);

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

            return(CreatedAtRoute("DefaultApi", new { id = spindleBeltSize.TypeID }, spindleBeltSize));
        }
        public async Task <IActionResult> PutSpindleBeltSize(string id, [FromBody] SpindleBeltSize spindleBeltSize)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

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

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

            return(StatusCode((int)HttpStatusCode.NoContent));
        }
        public async Task <IActionResult> GetSpindleBeltSize(string id)
        {
            SpindleBeltSize spindleBeltSize = await db.SpindleBeltSizes.FindAsync(id);

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

            return(Ok(spindleBeltSize));
        }
        public async Task <IActionResult> DeleteSpindleBeltSize(string id)
        {
            SpindleBeltSize spindleBeltSize = await db.SpindleBeltSizes.FindAsync(id);

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

            db.SpindleBeltSizes.Remove(spindleBeltSize);
            await db.SaveChangesAsync();

            return(Ok(spindleBeltSize));
        }