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
|
||||
{
|
||||
@@ -508,9 +510,9 @@ namespace WorkFlowCheck.API.Controllers
|
||||
try
|
||||
{
|
||||
var result = await _messageService.SendMailAsync(
|
||||
new List<string>()
|
||||
{
|
||||
"ivan.szabo.sis@gmail.com",
|
||||
new List<string>()
|
||||
{
|
||||
"ivan.szabo.sis@gmail.com",
|
||||
}, "Teszt", "Ok");
|
||||
retVal.Data = true;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user