Пример #1
0
        public async Task <int> CreateAsync(ArtistDTO artist)
        {
            var entity = new Artist
            {
                Name = artist.Name
            };

            _context.Artists.Add(entity);

            return(await _context.SaveChangesAsync());
        }
Пример #2
0
        public async Task <bool> UpdateAsync(ArtistDTO artist)
        {
            var entity = await _context.Artists.FindAsync(artist.Id);

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

            entity.Name = artist.Name;

            await _context.SaveChangesAsync();

            return(true);
        }