Elég sok minden ...
This commit is contained in:
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user