* Changed views to have them in the same layout
* Added Authorization
This commit is contained in:
@@ -2,27 +2,30 @@ using OrdersManagementDataModel.Dtos;
|
||||
|
||||
namespace OrdersManagement.Services;
|
||||
|
||||
public class HangfireService(HttpClient httpClient)
|
||||
public class HangfireService(
|
||||
IHttpClientFactory httpClientFactory,
|
||||
CustomAuthenticationStateProvider authenticationStateProvider)
|
||||
: ServiceBase<TaskSchedulerDto>(httpClientFactory, authenticationStateProvider)
|
||||
{
|
||||
public async Task<IEnumerable<TaskSchedulerDto>?> GetTaskSchedulersAsync()
|
||||
{
|
||||
return await httpClient.GetFromJsonAsync<IEnumerable<TaskSchedulerDto>>("api/HangfireJobs/GetTasks");
|
||||
return await GetListAsync("api/HangfireJobs/");
|
||||
}
|
||||
|
||||
public async Task<TaskSchedulerDto?> GetTaskSchedulerAsync(Guid id)
|
||||
{
|
||||
return await httpClient.GetFromJsonAsync<TaskSchedulerDto>($"api/HangfireJobs/{id}");
|
||||
return await GetEntityAsync($"api/HangfireJobs/{id}");
|
||||
}
|
||||
|
||||
public async Task<int> AddTaskSchedulerAsync(TaskSchedulerDto taskSchedulerDto)
|
||||
{
|
||||
HttpResponseMessage responseMessage = await httpClient.PostAsJsonAsync("api/HangfireJobs/AddTask", taskSchedulerDto);
|
||||
HttpResponseMessage responseMessage = await PostAsJsonAsync("api/HangfireJobs/add", taskSchedulerDto);
|
||||
return responseMessage.IsSuccessStatusCode ? 1 : 0;
|
||||
}
|
||||
|
||||
public async Task<int> DeleteTaskSchedulerAsync(TaskSchedulerDto taskSchedulerDto)
|
||||
{
|
||||
HttpResponseMessage responseMessage = await httpClient.PostAsJsonAsync("api/HangfireJobs/DeleteTask", taskSchedulerDto);
|
||||
HttpResponseMessage responseMessage = await PostAsJsonAsync("api/HangfireJobs/delete", taskSchedulerDto);
|
||||
return responseMessage.IsSuccessStatusCode ? 1 : 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user