NFC azonosítás is beállítva

This commit is contained in:
2025-04-06 14:41:36 +02:00
parent 71a5850d65
commit dc3e6e2f7b
8 changed files with 157 additions and 17 deletions
+39 -1
View File
@@ -109,6 +109,44 @@ namespace WorkFlowCheck.MAUI.Services
};
}
}
public async Task<ApiResponseDTO<UserDTO>> AuthenticateNFC(string NFCCode)
{
try
{
// Az API végpont meghatározása
string endpoint = $"{_httpClient.BaseAddress}api/user/authenticatenfc";
var userSimpleDTO = new UserSimpleDTO()
{
UserName = NFCCode,
Password = NFCCode,
};
// HTTP POST kérés küldése
using (HttpResponseMessage httpResponseMessage = await _httpClient.PostAsJsonAsync(endpoint, userSimpleDTO))
{
httpResponseMessage.EnsureSuccessStatusCode();
var jsonString = await httpResponseMessage.Content.ReadAsStringAsync();
var response = JsonConvert.DeserializeObject<ApiResponseDTO<UserDTO>>(jsonString);
return response ?? new ApiResponseDTO<UserDTO>
{
IsSuccess = false,
};
}
}
catch (Exception ex)
{
// Hiba visszaadása
return new ApiResponseDTO<UserDTO>
{
IsSuccess = false
};
}
}
public async Task<ApiResponseDTO<string>> SyncUsers_Up(Action<double, string> reportProgress)
{
var retVal = new ApiResponseDTO<string>();
@@ -116,7 +154,7 @@ namespace WorkFlowCheck.MAUI.Services
{
await PrepareAuthenticatedRequestAsync();
var userList = await _dbContext.Users.ToListAsync();
var userList = await _dbContext.MobileUsers.ToListAsync();
var userListDTO = _mapper.Map<List<UserDTO>>(userList);
var endpoint = $"{_httpClient.BaseAddress}api/Sync/UpdateAllUser";