Files
FA_WEB/OrdersManagement/Services/HangfireService.cs
2025-02-28 13:33:01 +01:00

31 lines
1.1 KiB
C#

using OrdersManagementDataModel.Dtos;
namespace OrdersManagement.Services;
public class HangfireService(
IHttpClientFactory httpClientFactory,
CustomAuthenticationStateProvider authenticationStateProvider)
: ServiceBase<TaskSchedulerDto>(httpClientFactory, authenticationStateProvider)
{
public async Task<IEnumerable<TaskSchedulerDto>?> GetTaskSchedulersAsync()
{
return await GetListAsync("api/HangfireJobs/");
}
public async Task<TaskSchedulerDto?> GetTaskSchedulerAsync(Guid id)
{
return await GetEntityAsync($"api/HangfireJobs/{id}");
}
public async Task<int> AddTaskSchedulerAsync(TaskSchedulerDto taskSchedulerDto)
{
HttpResponseMessage responseMessage = await PostAsJsonAsync("api/HangfireJobs/add", taskSchedulerDto);
return responseMessage.IsSuccessStatusCode ? 1 : 0;
}
public async Task<int> DeleteTaskSchedulerAsync(TaskSchedulerDto taskSchedulerDto)
{
HttpResponseMessage responseMessage = await PostAsJsonAsync("api/HangfireJobs/delete", taskSchedulerDto);
return responseMessage.IsSuccessStatusCode ? 1 : 0;
}
}