Invocar uma Web API em DDD
Invocação de Web API em DDD |
Console Application
using System.Threading.Tasks;
using WebApiClient.Poc.Core.Interfaces;
using WebApiClient.Poc.Core.Entities;
using WebApiClient.PoC.HttpClientServices.Inventory;
using WebApiClient.PoC.HttpClientServices;
namespace WebApiClient.Poc.Console
{
class Program
{
static void Main(string[] args)
{
RunAsync("19072000408").GetAwaiter().GetResult();
}
private static async Task RunAsync(string authorCode)
{
IAuthorInventoryService _inventoryService = new AuthorInventoryService(new HttpClientWrapper<Author>());
await _inventoryService.GetInventoryAsync(authorCode);
}
}
}
Referência: Call a Web API From a .NET Client (C#)
Licença CC BY-SA 4.0
Silvia Pinhão Lopes, 24.7.19
Sem comentários: