using Domain.Entities; using System.Net.Http.Json; namespace phronCare.UIBlazor.Services.Tickets { public class TicketsService { private readonly HttpClient _httpClient; public List? dashboard; public TicketsService(HttpClient httpClient) { _httpClient = httpClient; } public async Task> GetSummary() { var response = await _httpClient.GetFromJsonAsync>("/api/Ticket/GetSummary"); if (response is null) { response = Enumerable.Empty(); } return response; } public async Task> GetDashboardDetail(string estado, string orden) { try { var response = await _httpClient.PostAsJsonAsync("/api/Ticket/GetDashboardDetail", new { Param1 = estado, Param2 = orden }); response.EnsureSuccessStatusCode(); var content = await response.Content.ReadFromJsonAsync>(); return content ?? Enumerable.Empty(); } catch (HttpRequestException ex) { throw new Exception("Error al obtener el dashboard: " + ex.Message, ex); } } } }