From 4dbda1aac322bce8f90f04a54085193f5390961b Mon Sep 17 00:00:00 2001 From: ivanszabo Date: Tue, 15 Apr 2025 19:42:39 +0200 Subject: [PATCH] =?UTF-8?q?User=20NFCCode=20is=20r=C3=B6gz=C3=ADt=C3=A9sre?= =?UTF-8?q?=20ker=C3=BClj=C3=B6n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/SyncController.cs | 30 +++++++++++++++++++ .../Services/Interfaces/ISyncService.cs | 5 +++- src/WorkFlowCheck.BL/Services/UserService.cs | 2 ++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/WorkFlowCheck.API/Controllers/SyncController.cs b/src/WorkFlowCheck.API/Controllers/SyncController.cs index 1bc8bcb..0e8fe8c 100644 --- a/src/WorkFlowCheck.API/Controllers/SyncController.cs +++ b/src/WorkFlowCheck.API/Controllers/SyncController.cs @@ -552,5 +552,35 @@ namespace WorkFlowCheck.API.Controllers if (retVal.Data == null || retVal.Data.Count <= 0) { retVal.IsSuccess = false; retVal.Errors.Add("No data!"); } return retVal; } + + [HttpPost("UpdateAllMobileUser")] + public async Task>> UpdateAllMobileUser([FromBody] List mobileUserListDTO) + { + var retVal = new ApiResponseDTO>() + { + IsSuccess = true + }; + + try + { + foreach (var mobileUserDTO in mobileUserListDTO) + { + var userDTO = await _userService.GetUserAsync(mobileUserDTO.Id); + if (userDTO != null && userDTO.Id == mobileUserDTO.Id) + { + userDTO.NFCCode = mobileUserDTO.NFCCode; + var result = await _userService.UpdateUserAsync(userDTO); + + } + + } + } + catch (Exception ex) + { + retVal.IsSuccess = false; + Log.Error(ex.Message); + } + return retVal; + } } } diff --git a/src/WorkFlowCheck.BL/Services/Interfaces/ISyncService.cs b/src/WorkFlowCheck.BL/Services/Interfaces/ISyncService.cs index 4906c49..3331512 100644 --- a/src/WorkFlowCheck.BL/Services/Interfaces/ISyncService.cs +++ b/src/WorkFlowCheck.BL/Services/Interfaces/ISyncService.cs @@ -1,4 +1,5 @@ -using WorkFlowCheck.Common.DTO; +using Microsoft.AspNetCore.Mvc; +using WorkFlowCheck.Common.DTO; namespace WorkFlowCheck.BL.Services.Interfaces @@ -31,5 +32,7 @@ namespace WorkFlowCheck.BL.Services.Interfaces Task DeviceMessageSend(DeviceMessageDTO deviceMessageDTO); Task> DeviceMessageReadUnreaded(string deviceId); + + } } diff --git a/src/WorkFlowCheck.BL/Services/UserService.cs b/src/WorkFlowCheck.BL/Services/UserService.cs index a96249d..59151e1 100644 --- a/src/WorkFlowCheck.BL/Services/UserService.cs +++ b/src/WorkFlowCheck.BL/Services/UserService.cs @@ -394,6 +394,8 @@ namespace WorkFlowCheck.BL.Services user.Email = userDTO.Email; user.Active = userDTO.Active; user.NFCActive = userDTO.NFCActive; + user.NFCCode = userDTO.NFCCode; + await _dbContext.SaveChangesAsync(); retVal = _mapper.Map(user);