Пример #1
0
        public async Task UpdateSuperHeroAsync(int id)
        {
            var hero = new SuperHero {
                Id = id
            };

            _context.Attach(hero);
            _context.Update(hero);
            await _context.SaveChangesAsync();
        }
Пример #2
0
        public async Task DeleteSuperPowerAsync(int id)
        {
            var superpower = new SuperPower {
                Id = id
            };

            _context.Attach(superpower);
            _context.Remove(superpower);
            await _context.SaveChangesAsync();
        }