* Changed views to have them in the same layout

* Added Authorization
This commit is contained in:
2025-02-28 13:33:01 +01:00
parent aedb5810c2
commit b8fbb789ad
35 changed files with 1605 additions and 1306 deletions

View File

@@ -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;
}
}