12345678910111213141516171819202122232425 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Http;
- using System.Net.Http.Json;
- using System.Text;
- using System.Threading.Tasks;
- namespace AvaloniaApplication1.Models
- {
- public class ApiService
- {
- private readonly HttpClient _httpClient;
- public ApiService()
- {
- _httpClient = new HttpClient();
- _httpClient.BaseAddress = new Uri("https://localhost:7241/");
- }
- public async Task<T?> GetAsync<T>(string endpint)
- {
- return await _httpClient.GetFromJsonAsync<T>(endpint);
- }
- }
- }
|