Elég sok minden ...

This commit is contained in:
2025-03-19 14:38:04 +01:00
parent f74922d01e
commit 63b9beef35
19 changed files with 1652 additions and 6 deletions
@@ -0,0 +1,56 @@
using Serilog;
using System.Net.Http;
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.Web.Services.Interfaces
{
public class CheckListService : BaseService, ICheckListService
{
public CheckListService(HttpClient httpClient, IConfiguration configuration, IHttpContextAccessor httpContextAccessor) : base(httpClient, configuration, httpContextAccessor)
{
}
public async Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync()
{
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetAllCheckListHeaders";
var retVal = new List<CheckListHeaderDTO>();
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<List<CheckListHeaderDTO>>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<CheckListHeaderDTO> GetCheckListHeader(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetCheckListHeader/{id}";
var retVal = new CheckListHeaderDTO() { CheckListRowDTO = new List<CheckListRowDTO>() };
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<CheckListHeaderDTO>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException();
}
}
@@ -0,0 +1,12 @@
using WorkFlowCheck.Common.DTO;
namespace WorkFlowCheck.Web.Services.Interfaces
{
public interface ICheckListService
{
Task<CheckListHeaderDTO> GetCheckListHeader(int id);
Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync();
Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
}
}