MobilUser lekérdezése
This commit is contained in:
@@ -16,15 +16,18 @@ namespace WorkFlowCheck.API.Controllers
|
||||
private ISyncService _syncService;
|
||||
private INumberGeneratorService _numberGeneratorService;
|
||||
private IMessageService _messageService;
|
||||
private IUserService _userService;
|
||||
|
||||
|
||||
public SyncController(ISyncService syncService,
|
||||
INumberGeneratorService numberGeneratorService,
|
||||
IUserService userService,
|
||||
IMessageService messageService)
|
||||
{
|
||||
_syncService = syncService;
|
||||
_numberGeneratorService = numberGeneratorService;
|
||||
_messageService = messageService;
|
||||
_userService = userService;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,13 +38,12 @@ namespace WorkFlowCheck.API.Controllers
|
||||
{
|
||||
IsSuccess = true,
|
||||
};
|
||||
var checkPointListDTO = await _syncService.GetCheckPointAsync(id);
|
||||
var checkPointDTO = await _syncService.GetCheckPointAsync(id);
|
||||
|
||||
if (checkPointListDTO != null)
|
||||
if (checkPointDTO != null)
|
||||
{
|
||||
|
||||
retVal.IsSuccess = true;
|
||||
retVal.Data = checkPointListDTO;
|
||||
retVal.Data = checkPointDTO;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -522,5 +524,33 @@ namespace WorkFlowCheck.API.Controllers
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("GetAllMobileUsers")]
|
||||
public async Task<ApiResponseDTO<List<MobileUserDTO>>> GetAllMobileUsers()
|
||||
{
|
||||
var retVal = new ApiResponseDTO<List<MobileUserDTO>>()
|
||||
{
|
||||
IsSuccess = true,
|
||||
Data = new List<MobileUserDTO>()
|
||||
};
|
||||
var usersListDTO = await _userService.GetAllUserAsync();
|
||||
|
||||
retVal.Data.AddRange(usersListDTO
|
||||
.Where(user => user.RoleDTO.Any(role => role.CanUseMobilApp))
|
||||
.Select(user => new MobileUserDTO
|
||||
{
|
||||
Id = user.Id,
|
||||
Email = user.Email,
|
||||
FirstName = user.FirstName,
|
||||
LastName = user.LastName,
|
||||
NFCActive = user.NFCActive,
|
||||
NFCCode = user.NFCCode,
|
||||
UserName = user.UserName
|
||||
})
|
||||
);
|
||||
if (retVal.Data == null || retVal.Data.Count <= 0) { retVal.IsSuccess = false; retVal.Errors.Add("No data!"); }
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,7 +68,10 @@ namespace WorkFlowCheck.BL.Services
|
||||
};
|
||||
try
|
||||
{
|
||||
var users = await _dbContext.Users.ToListAsync();
|
||||
var users = await _dbContext.Users
|
||||
.Include(i => i.UserRoles)
|
||||
.ThenInclude(i => i.Role)
|
||||
.ToListAsync();
|
||||
if (users != null)
|
||||
{
|
||||
retVal = _mapper.Map<List<UserDTO>>(users);
|
||||
|
||||
@@ -13,7 +13,6 @@ namespace WorkFlowCheck.Common.DTO
|
||||
public string? FirstName { get; set; }
|
||||
public string? LastName { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? PhoneNumber { get; set; }
|
||||
public bool NFCActive { get; set; }
|
||||
public string NFCCode { get; set; } = null!;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
}
|
||||
],
|
||||
|
||||
processing:true,
|
||||
processing: true,
|
||||
language: { url: '//cdn.datatables.net/plug-ins/2.2.2/i18n/hu.json',}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user