Open Source Web Application Framework for ASP.NET Core
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

27 lines
860 B

using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.DependencyInjection;
namespace Acme.BookStore.ConsoleApiClient
{
public class ApiClientDemoService : ITransientDependency
{
private readonly IBookAppService _bookAppService;
public ApiClientDemoService(IBookAppService bookAppService)
{
_bookAppService = bookAppService;
}
public async Task RunAsync()
{
//While it seems like a regular method call, it actually calls a remote REST API.
var output = await _bookAppService.GetListAsync(new PagedAndSortedResultRequestDto());
foreach (var bookDto in output.Items)
{
Console.WriteLine($"[BOOK {bookDto.Id}] Name={bookDto.Name}, Price={bookDto.Price}");
}
}
}
}