public async Task QueueNoUp(string roomNo) { var claimsIdentity = (ClaimsIdentity)Context.User.Identity; var claim = claimsIdentity.FindFirst(ClaimTypes.NameIdentifier); var userId = claim.Value; var hubUser = _hubUser.GetConnectedUsers().Where(u => u.UserId == userId).FirstOrDefault(); if (hubUser != null) { WebApp.Models.Queue outputQueue = await _queueService.QueueNoUp(userId); await Clients.Group(roomNo).SendAsync("ReceiveQueueNo", userId, outputQueue.QueueNoMessage); } }
public async Task <IActionResult> ManageHubUser(string roomNo) { var userMaster = new Entities.Models.User(); var groupMaster = _manageHubUser.GetGroupMaster(roomNo); if (groupMaster != null) { userMaster = _repo.User.FindByCondition(u => u.Id == groupMaster.First().UserId).FirstOrDefault(); } var connectedUsers = new List <HubUserVM>(); GenerateHubUserVM(connectedUsers, _manageHubUser.GetConnectedUsers(roomNo)); var waitingUsers = new List <HubUserVM>(); GenerateHubUserVM(waitingUsers, _manageHubUser.GetWaitingUsers(roomNo)); ManageHubUserVM = new ManageHubUserViewModel() { GroupName = roomNo, ConnectedUsers = connectedUsers, WaitingUsers = waitingUsers, GroupMaster = _mapper.Map <WebApp.Models.User>(userMaster) }; return(View(ManageHubUserVM)); }
public void TestGettingAllConnectedUsers() { var hubUsers = PrepareHubUsers(); foreach (var user in hubUsers) { _manageHubUser.AddUser(user); } var connectedUsers = _manageHubUser.GetConnectedUsers(); Assert.Equal(4, connectedUsers.Count()); }