예제 #1
0
        public ActionResult <SpellElementEntity> PostSpellElementEntity(SpellElementEntity spellElement)
        {
            _context.spellElement.Add(spellElement);
            _context.SaveChanges();

            return(Ok(spellElement));
        }
예제 #2
0
 public ExtendedSpellDto(SpellEntity spell, SpellElementEntity spellElement)
 {
     this.id          = spell.id;
     this.name        = spell.name;
     this.elementName = spellElement.name;
     this.cost        = spell.cost;
 }
예제 #3
0
        public IActionResult PutSpellElementEntity(int id, SpellElementEntity spellElement)
        {
            if (id != spellElement.id)
            {
                return(BadRequest());
            }

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

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SpellElementEntityExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }