public IHttpActionResult Post(AccessoryCreate accessory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateAccessoryService();

            if (!service.CreateAccessory(accessory))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
        public bool CreateAccessory(AccessoryCreate model)
        {
            var entity = new Accessory()
            {
                Name = model.Name,
                InstrumentAssociated = (InstrumentType)model.InstrumentAssociatedId,
                Brand       = model.Brand,
                Quantity    = model.Quantity,
                Price       = model.Price,
                Description = model.Description,
            };

            using (ApplicationDbContext ctx = new ApplicationDbContext())
            {
                ctx.Accessories.Add(entity);
                return(ctx.SaveChanges() == 1);
            }
        }