Example #1
0
        internal Guid CreateList(Guid ownerId, string name, string description, bool isPrivate, bool isPersonal)
        {
            Guid id = Guid.NewGuid();

            AccountStorageTmp.FullAccountInfo accountInfo = this.motherStorage.account.GetFullInfo(ownerId);
            var listInfo = new FullListInfo
            {
                Id        = id,
                Followers = new HashSet <Guid> {
                    ownerId
                },
                ListInfo = new ListInfo(name, description, isPrivate, isPersonal),
                Members  = new HashSet <Guid> {
                    ownerId
                },
                Messages = new List <IMessage>(),
                OwnerId  = ownerId
            };

            accountInfo.MemberOfLists.Add(id);
            accountInfo.FollowerOfLists.Add(id);
            this.infoFromId.Add(id, listInfo);

            return(id);
        }
Example #2
0
        public void Add(Guid listId, Guid accountId)
        {
            FullListInfo listInfo = this.GetFullInfo(listId);

            AccountStorageTmp.FullAccountInfo accountInfo = this.motherStorage.account.GetFullInfo(accountId);

            listInfo.Members.Add(accountId);
            accountInfo.MemberOfLists.Add(listId);
        }
Example #3
0
        public void Unfollow(Guid listId, Guid accountId)
        {
            FullListInfo listInfo = this.GetFullInfo(listId);

            AccountStorageTmp.FullAccountInfo accountInfo = this.motherStorage.account.GetFullInfo(accountId);

            listInfo.Followers.Remove(accountId);
            accountInfo.FollowerOfLists.Remove(listId);
        }
Example #4
0
        internal Guid CreateList(Guid ownerId, string name, string description, bool isPrivate, bool isPersonal)
        {
            Guid id = Guid.NewGuid();
            AccountStorageTmp.FullAccountInfo accountInfo = this.motherStorage.account.GetFullInfo(ownerId);
            var listInfo = new FullListInfo
                {
                    Id = id,
                    Followers = new HashSet<Guid> { ownerId },
                    ListInfo = new ListInfo(name, description, isPrivate, isPersonal),
                    Members = new HashSet<Guid> { ownerId },
                    Messages = new List<IMessage>(),
                    OwnerId = ownerId
                };

            accountInfo.MemberOfLists.Add(id);
            accountInfo.FollowerOfLists.Add(id);
            this.infoFromId.Add(id, listInfo);

            return id;
        }