31 lines
895 B
C#
31 lines
895 B
C#
using System.Net.Http.Json;
|
|
using TIAM.Entities.TransferDestinations;
|
|
using TIAMWebApp.Shared.Application.Interfaces;
|
|
using TIAMWebApp.Shared.Application.Models;
|
|
|
|
namespace TIAMMobileApp.Services
|
|
{
|
|
|
|
public class TransferDataService : ITransferDataService
|
|
{
|
|
private readonly HttpClient http;
|
|
|
|
public TransferDataService(HttpClient http)
|
|
{
|
|
this.http = http;
|
|
}
|
|
|
|
/// <summary>
|
|
/// calls the TransferDataAPI to get the list of destinations
|
|
public Task<TransferDestination[]?> GetDestinationsAsync()
|
|
{
|
|
return http.GetFromJsonAsync<TransferDestination[]>("TransferDataAPI");
|
|
}
|
|
|
|
public Task<TransferDestination?> GetDestinationAsync(string destinationId)
|
|
{
|
|
return http.GetFromJsonAsync<TransferDestination?>($"TransferDataAPI/{destinationId}");
|
|
}
|
|
}
|
|
}
|