Exemplo n.º 1
0
        public int Create(CharacterCreateUpdateDTO character)
        {
            var entity = new Character
            {
                ActorId = character.ActorId,
                Name    = character.Name,
                Species = character.Species,
                Planet  = character.Planet,
            };

            _context.Characters.Add(entity);

            _context.SaveChanges();

            return(entity.Id);
        }
Exemplo n.º 2
0
        public bool Delete(int characterId)
        {
            var entity = _context.Characters.Find(characterId);

            if (entity == null)
            {
                return(false);
            }

            _context.Characters.Remove(entity);

            _context.SaveChanges();

            return(true);
        }