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);