CheckListRow edit

This commit is contained in:
2025-03-28 17:35:29 +01:00
parent 728b6a8a9e
commit 77796f3247
7 changed files with 286 additions and 1 deletions
@@ -150,6 +150,56 @@ namespace WorkFlowCheck.Web.Services
};
}
}
public async Task<CheckListRowDTO> GetCheckListRow(int id)
{
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/GetCheckListRow/{id}";
var retVal = new CheckListRowDTO();
try
{
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<CheckListRowDTO>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
return response.Data;
}
}
}
catch (Exception ex)
{
Log.Error(ex.Message);
}
return retVal;
}
public async Task<ApiResponseDTO<CheckListRowDTO>> UpdateCheckListRow(CheckListRowDTO checkListRowDTO)
{
try
{
string endpoint = $"{_httpClient.BaseAddress}api/CheckList/UpdateCheckListRow";
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, checkListRowDTO))
{
httpResponseMessage.EnsureSuccessStatusCode();
var jsonString = await httpResponseMessage.Content.ReadAsStringAsync();
var response = JsonConvert.DeserializeObject<ApiResponseDTO<CheckListRowDTO>>(jsonString);
return response ?? new ApiResponseDTO<CheckListRowDTO>
{
IsSuccess = false,
};
}
}
catch (Exception ex)
{
// Hiba visszaadása
return new ApiResponseDTO<CheckListRowDTO>
{
IsSuccess = false
};
}
}
}
}
@@ -15,5 +15,8 @@ namespace WorkFlowCheck.Web.Services.Interfaces
Task<CheckListTemplateRowDTO> GetCheckListTemplateRow(int id);
Task<ApiResponseDTO<CheckListTemplateRowDTO>> UpdateCheckListTemplateRow(CheckListTemplateRowDTO checkListTemplateRowDTO);
Task<CheckListRowDTO> GetCheckListRow(int id);
Task<ApiResponseDTO<CheckListRowDTO>> UpdateCheckListRow(CheckListRowDTO checkListRowDTO);
}
}