Пример #1
0
        public async Task FetchGroupList(StandardCommand c)
        {
            if (c.SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId) && c.SessionToken == connectedUsers[Context.ConnectionId].SessionToken)
            {
                (ListOf_DBResult flag, List <Group> groups) = await HoloData.FetchGroups(c.SessionToken);

                UpdateModel updateModel = new UpdateModel();
                updateModel.AddGroupList(groups);
                ClientUpdates.SendUpdate(Clients.Caller, flag, updateModel);
            }
        }
Пример #2
0
        public async Task CreateGroup(Group NewGroup)
        {
            string SessionToken = connectedUsers[Context.ConnectionId].SessionToken;

            if (SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId))
            {
                (ListOf_DBResult flag, Group group) = await HoloData.CreateGroup(SessionToken, new Group()
                {
                    Name = NewGroup.Name, ConnectionId = NewGroup.ConnectionId
                });

                if (flag == ListOf_DBResult.Success)
                {
                    UpdateModel updateModel = new UpdateModel();
                    updateModel.AddGroupList(group);
                    ClientUpdates.SendUpdate(connectedUsers.Where(x => x.Value.SessionToken == SessionToken).Select(x => Clients.Client(x.Key)).ToList(), flag, updateModel);
                }
                else
                {
                    ClientUpdates.SendUpdate(connectedUsers.Where(x => x.Value.SessionToken == SessionToken).Select(x => Clients.Client(x.Key)).ToList(), flag);
                }
            }
        }