コード例 #1
0
 public dynamic this[int SessionUserID]
 {
     get
     {
         return(UsersConnected.First(x => { return ((int)x.Value["SessionUserID"]) == SessionUserID; }));
     }
 }
コード例 #2
0
 /// <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;
     }
 }
コード例 #3
0
        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));
        }
コード例 #4
0
        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;
                }
            }
        }
コード例 #5
0
        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());
            }
        }
コード例 #6
0
 public bool ContainsConnection(string ConnectionID)
 {
     return(UsersConnected.ContainsKey(ConnectionID));
 }
コード例 #7
0
 public void RemoveSession(string ConnectionID)
 {
     UsersConnected.Remove(ConnectionID);
 }