public async Task <IReadOnlyList <UserDeviceDto> > GetUserDevicesAsync(Guid userId)
 {
     using (_dbContextScopeFactory.CreateReadOnly())
     {
         return(await _userDeviceRepository
                .GetAll()
                .AsNoTracking()
                .Where(device => device.IsActive && device.UserId == userId)
                .ProjectTo <UserDeviceDto>(_mapper.ConfigurationProvider)
                .ToListAsync());
     }
 }
Ejemplo n.º 2
0
 public ActionResult GetAll()
 {
     try
     {
         var data = userDeviceRepository.GetAll();
         return(Ok(new { success = true, data = data }));
     }
     catch (Exception ex)
     {
         return(Ok(new { success = false, errorMessage = ex.GetBaseException() }));
     }
 }