public async Task <IHttpActionResult> PutPoparts(int id, Poparts poparts)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != poparts.Id)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> GetPoparts(int id)
        {
            Poparts poparts = await db.Poparts.FindAsync(id);

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

            return(Ok(poparts));
        }
        public async Task <IHttpActionResult> PostPoparts(Poparts poparts)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Poparts.Add(poparts);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = poparts.Id }, poparts));
        }
        public async Task <IHttpActionResult> DeletePoparts(int id)
        {
            Poparts poparts = await db.Poparts.FindAsync(id);

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

            db.Poparts.Remove(poparts);
            await db.SaveChangesAsync();

            return(Ok(poparts));
        }