Пример #1
0
        public async Task <ActorDetailedDTO> CreateAsync(ActorCreateUpdateDTO actor)
        {
            var entity = new Actor
            {
                Name = actor.Name
            };

            _context.Actors.Add(entity);
            await _context.SaveChangesAsync();

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

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

            entity.Name = actor.Name;

            await _context.SaveChangesAsync();

            return(true);
        }