public async Task <IActionResult> DeleteSpellFromSpellbook([FromBody] SpellbookSpell spell)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var spellbook = await _context.Spellbooks.SingleOrDefaultAsync(m => m.SpellbookId == spell.SpellbookId);

            if (spellbook == null)
            {
                return(NotFound());
            }
            _context.SpellbookSpell.Remove(spell);
            await _context.SaveChangesAsync();

            return(Ok());
        }
        public async Task <IActionResult> AddSpell([FromBody] SpellbookSpell spellToAdd)
        {
            var spellbook = _context.Spellbooks.Where(x => x.SpellbookId == spellToAdd.SpellbookId).FirstOrDefault();
            var spell     = _context.Spells.Where(x => x.SpellId == spellToAdd.SpellId).FirstOrDefault();

            if (spellbook != null && spell != null)
            {
                if (spellbook.SpellbookSpells == null)
                {
                    spellbook.SpellbookSpells = new List <SpellbookSpell>();
                }
                spellToAdd.Spellbook = spellbook;
                spellToAdd.Spell     = spell;
                spellbook.SpellbookSpells.Add(spellToAdd);
                await _context.SaveChangesAsync();
            }
            else
            {
                return(BadRequest());
            }
            return(CreatedAtAction("GetSpellbook", new { id = spellbook.SpellbookId }, spellbook));
        }