37 lines
1.4 KiB
C#
37 lines
1.4 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;
|
|
}
|
|
|
|
public async Task<int> UpdateTaskSchedulerAsync(TaskSchedulerDto taskSchedulerDto)
|
|
{
|
|
HttpResponseMessage responseMessage = await PostAsJsonAsync("api/HangfireJobs/update", taskSchedulerDto);
|
|
return responseMessage.IsSuccessStatusCode ? 1 : 0;
|
|
}
|
|
} |