CheckListServices továbbfejlesztése
This commit is contained in:
@@ -144,7 +144,7 @@ namespace WorkFlowCheck.Web.Services
|
||||
|
||||
public async Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id)
|
||||
{
|
||||
string endpoint = $"{_httpClient.BaseAddress}api/Sync/GetCheckListTemplateRow/{id}";
|
||||
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetCheckListTemplateRow/{id}";
|
||||
var retVal = new CheckListTemplateRowDTO();
|
||||
try
|
||||
{
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
using Serilog;
|
||||
using System.Net.Http;
|
||||
using WorkFlowCheck.Common.DTO;
|
||||
using WorkFlowCheck.Web.Services.Interfaces;
|
||||
|
||||
namespace WorkFlowCheck.Web.Services
|
||||
{
|
||||
public class CheckListService : BaseService, ICheckListService
|
||||
{
|
||||
public CheckListService(HttpClient httpClient, IConfiguration configuration, IHttpContextAccessor httpContextAccessor) : base(httpClient, configuration, httpContextAccessor)
|
||||
{
|
||||
}
|
||||
|
||||
public async Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync()
|
||||
{
|
||||
var 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)
|
||||
{
|
||||
var 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();
|
||||
|
||||
|
||||
public async Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync()
|
||||
{
|
||||
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetAllCheckListTemplateHeaders";
|
||||
var retVal = new List<CheckListTemplateHeaderDTO>();
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<List<CheckListTemplateHeaderDTO>>>(endpoint);
|
||||
if (response != null)
|
||||
{
|
||||
if (response.IsSuccess)
|
||||
{
|
||||
return response.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeader(int id)
|
||||
{
|
||||
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetCheckListTemplateHeader/{id}";
|
||||
var retVal = new CheckListTemplateHeaderDTO() { CheckListTemplateRowDTO = new List<CheckListTemplateRowDTO>() };
|
||||
try
|
||||
{
|
||||
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<CheckListTemplateHeaderDTO>>(endpoint);
|
||||
if (response != null)
|
||||
{
|
||||
if (response.IsSuccess)
|
||||
{
|
||||
return response.Data;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.Message);
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
public async Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> UpdateCheckListTemplateHeader(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO) => throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,10 @@ namespace WorkFlowCheck.Web.Services.Interfaces
|
||||
Task<CheckListHeaderDTO> GetCheckListHeader(int id);
|
||||
Task<List<CheckListHeaderDTO>> GetAllCheckListHeaderAsync();
|
||||
Task<ApiResponseDTO<CheckListHeaderDTO>> UpdateCheckListHeader(CheckListHeaderDTO checkListHeaderDTO);
|
||||
|
||||
|
||||
Task<CheckListTemplateHeaderDTO> GetCheckListTemplateHeader(int id);
|
||||
Task<List<CheckListTemplateHeaderDTO>> GetAllCheckListTemplateHeaderAsync();
|
||||
Task<ApiResponseDTO<CheckListTemplateHeaderDTO>> UpdateCheckListTemplateHeader(CheckListTemplateHeaderDTO checkListTemplateHeaderDTO);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user