Ejemplo n.º 1
0
        public async Task <bool> UpdateAsync(Publisher item, CancellationToken cancellationToken = default)
        {
            using (var context = new BookLibraryContext(this._optionsBuilder.Options))
            {
                var publisher = await context.Publishers.SingleOrDefaultAsync(o => o.Id == item.Id, cancellationToken);

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

                item.Adapt(publisher);

                await context.SaveChangesAsync(cancellationToken);

                return(true);
            }
        }