Jóváhagyás gomb MOBIL-on

This commit is contained in:
2025-04-17 14:39:50 +02:00
parent 2798aeaf0d
commit dbc2f30a27
3 changed files with 104 additions and 2 deletions
@@ -178,6 +178,37 @@ namespace WorkFlowCheck.MAUI.Services
}
public async Task<bool> UnBlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO)
{
var retVal = false;
try
{
var checkListHeader = await _dbContext.CheckListHeaders
.Where(w => w.Id == checkListHeaderDTO.Id)
.FirstOrDefaultAsync();
if (checkListHeader != null)
{
var userDTO = _userService.GetCurrentUser();
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/BlockCheckListHeader/{checkListHeaderDTO.Id}/{userDTO.Id}";
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
checkListHeader.CheckStatus = CheckStatus.InProgress;
await _dbContext.SaveChangesAsync();
retVal = true;
}
}
}
}
catch (Exception ex)
{
}
return retVal;
}
public async Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO)
{
var retVal = false;
try
@@ -208,7 +239,36 @@ namespace WorkFlowCheck.MAUI.Services
}
return retVal;
}
public async Task<bool> BlockCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException();
public async Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO) => throw new NotImplementedException();
public async Task<bool> AcceptCheckListHeader(CheckListHeaderDTO checkListHeaderDTO)
{
var retVal = false;
try
{
var checkListHeader = await _dbContext.CheckListHeaders
.Where(w => w.Id == checkListHeaderDTO.Id)
.FirstOrDefaultAsync();
if (checkListHeader != null)
{
var userDTO = _userService.GetCurrentUser();
var endpoint = $"{_httpClient.BaseAddress}api/CheckList/AcceptCheckListHeader/{checkListHeaderDTO.Id}/{userDTO.Id}";
var response = await _httpClient.GetFromJsonAsync<ApiResponseDTO<bool>>(endpoint);
if (response != null)
{
if (response.IsSuccess)
{
checkListHeader.CheckStatus = CheckStatus.InProgress;
await _dbContext.SaveChangesAsync();
retVal = true;
}
}
}
}
catch (Exception ex)
{
}
return retVal;
}
}
}