Ejemplo n.º 1
0
        private void CreateCommunityMember(UserType userType, MemberType memberType, CommunityType communityType)
        {
            var member = new CommunityMember();

            member.Id             = Guid.NewGuid();
            member.Role           = CommunityMember.MembershipRole.Member;
            member.CommunityGroup = CommunityGroups[communityType];
            member.User           = Users[userType];

            PooledBook pooledBook;

            foreach (var ownedBook in Users[userType].OwnedBooks)
            {
                pooledBook = new PooledBook
                {
                    Id              = Guid.NewGuid(),
                    OwnedBook       = ownedBook,
                    CommunityMember = member
                };
                member.PooledBooks.Add(pooledBook);
                PooledBooks.Add(pooledBook);
            }
            CommunityMembers.Add(memberType, member);
            Users[userType].Memberships.Add(member);
            CommunityGroups[communityType].CommunityMembers.Add(member);
        }
Ejemplo n.º 2
0
 public PooledBookDto(PooledBook entity)
 {
     Id        = entity.Id;
     Name      = entity.OwnedBook.Book.Name;
     Publisher = entity.OwnedBook.Book.Publisher;
     Series    = entity.OwnedBook.Book.Series;
     Notes     = entity.OwnedBook.Notes;
     Authors   = entity.OwnedBook.Book.Authors.Select(e => new AuthorDto(e.Author)).ToArray();
     Owner     = new CommunityMemberDto(entity.CommunityMember);
 }