public async Task <IActionResult> PutBeadsType(long id, BeadsType beadsType)
        {
            var name = _context.BeadsTypes.Where(b => b.Name == beadsType.Name).FirstOrDefault();

            if (name == null)
            {
                if (id != beadsType.Id)
                {
                    return(BadRequest());
                }

                _context.Entry(beadsType).State = EntityState.Modified;

                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BeadsTypeExists(id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(NoContent());
        }
        public async Task <ActionResult <BeadsType> > PostBeadsType(BeadsType beadsType)
        {
            var name = _context.BeadsTypes.Where(b => b.Name == beadsType.Name).FirstOrDefault();

            if (name == null)
            {
                _context.BeadsTypes.Add(beadsType);
                await _context.SaveChangesAsync();
            }
            return(CreatedAtAction("GetBeadsType", new { id = beadsType.Id }, beadsType));
        }
        public static void Initialize(ShopContext context)
        {
            Color color = new Color {
                Name = "red"
            };

            context.Colors.Add(color);
            context.SaveChanges();
            BeadsType type = new BeadsType {
                Name = "frosted"
            };

            context.BeadsTypes.Add(type);
            context.SaveChanges();/*
                                   * var beads = new[]
                                   * {
                                   * new Bead{ ColorId=1 , BeadsTypeId=1 , Num="1111",Image="dsfsd"},
                                   * new Bead{ ColorId=1 , BeadsTypeId=1 , Num="1112",Image="dsfsd"},
                                   * };
                                   * context.Beads.AddRange(beads);
                                   * context.SaveChanges();*/
        }