public async Task AddChapterAsync() { Console.WriteLine(nameof(AddChapterAsync)); BookChapter chapter = new BookChapter { Number = 42, Title = "ASP.NET Web API", Pages = 35 }; chapter = await _client.PostAsync(_urlService.BooksApi, chapter); Console.WriteLine($"added chapter {chapter.Title} with id {chapter.Id}"); Console.WriteLine(); }
public async Task AddChapterAsync() { Console.WriteLine(nameof(AddChapterAsync)); BookChapter chapter = new BookChapter { //Id = Guid.NewGuid(), //id可以直接在服务器中填充 Number = 34, Title = "ASP.NET Core Web API", PublisherNumber = 35 }; chapter = await _bookChapterClientService.PostAsync(_urlService.BookApi, chapter); Console.WriteLine($"added chapter {chapter.Id} {chapter.Title}"); }