Esempio n. 1
0
        public async Task <int> Handle(CreateBookStoreCommand request, CancellationToken cancellationToken)
        {
            var bookStore = new BookStore
            {
                BookStoreName = request.BookStoreName
            };

            _context.Add(bookStore);

            await _context.SaveChangesAsync(cancellationToken);

            return(bookStore.BookStoreId);
        }
        public async Task <int> Handle(CreateBookCommand request, CancellationToken cancellationToken)
        {
            var objectItem = new BookItem
            {
                BookStoreId = request.BookStoreId,
                BookName    = request.BookName
            };

            _context.Add(objectItem);

            await _context.SaveChangesAsync(cancellationToken);

            return(objectItem.BookId);
        }