public dynamic this[int SessionUserID] { get { return(UsersConnected.First(x => { return ((int)x.Value["SessionUserID"]) == SessionUserID; })); } }
/// <summary> /// /// </summary> /// <param name="Session"></param> /// <param name="ConnectionID"></param> protected void AddSessionSuper(dynamic Session, string ConnectionID) { if (!UsersConnected.ContainsKey(ConnectionID)) { UsersConnected.Add(ConnectionID, Session); } else { UsersConnected[ConnectionID] = Session; } }
public async Task <ActionResult <UsersConnected> > PostUsersConnected(UsersConnected usersConnected) { _context.usersConnecteds.Add(usersConnected); try { await _context.SaveChangesAsync(); } catch (DbUpdateException) { if (UsersConnectedExists(usersConnected.HubConnectionID)) { return(Conflict()); } else { throw; } } return(CreatedAtAction("GetUsersConnected", new { id = usersConnected.HubConnectionID }, usersConnected)); }
public async Task <ActionResult <bool> > PutUsersConnected(UsersConnected usersConnected) { _context.Entry(usersConnected).State = EntityState.Modified; try { await _context.SaveChangesAsync(); return(true); } catch (DbUpdateConcurrencyException) { if (!UsersConnectedExists(usersConnected.HubConnectionID)) { return(NotFound()); } else { throw; } } }
public async Task <ActionResult <bool> > ModifyOldConnections(UsersConnected usersConnected) { var userconnections = await _context.usersConnecteds.Where(usc => usc.UserID == usersConnected.UserID && usc.IsDisable == false).ToListAsync(); if (userconnections.Count() > 0) { foreach (var item in userconnections) { item.IsDisable = true; _context.Entry(item).State = EntityState.Modified; _context.SaveChanges(); } return(true); } else { return(NotFound()); } }
public bool ContainsConnection(string ConnectionID) { return(UsersConnected.ContainsKey(ConnectionID)); }
public void RemoveSession(string ConnectionID) { UsersConnected.Remove(ConnectionID); }