コード例 #1
0
        public async Task <BookDto> UpdateAsync(Guid id, CreateUpdateBookDto input)
        {
            var book = await Task.Run(() => _sampleBookDataService.GetBook(id));

            book.Name        = input.Name;
            book.Price       = input.Price;
            book.PublishDate = input.PublishDate;

            book = await Task.Run(() => _sampleBookDataService.UpdateBook(book));

            return(book);
        }
コード例 #2
0
        public async Task <BookDto> CreateAsync(CreateUpdateBookDto input)
        {
            var newBook = new BookDto
            {
                Id          = GuidGenerator.Create(),
                Name        = input.Name,
                PublishDate = input.PublishDate,
                Price       = input.Price
            };

            newBook = await Task.Run(() => _sampleBookDataService.CreateBook(newBook));

            return(newBook);
        }