Blog.Logic.ObjectMapper.CommunityMapper.ToDto C# (CSharp) 메소드

ToDto() 공개 정적인 메소드

public static ToDto ( Blog.DataAccess.Database.Entities.Objects community ) : Community
community Blog.DataAccess.Database.Entities.Objects
리턴 Community
        public static Community ToDto(Db.Community community)
        {
            if (community == null) return null;

            var members = community.Members != null
                ? community.Members.Select(UserMapper.ToDto).ToList()
                : null;
            var posts = community.Posts != null
                ? community.Posts.Select(PostMapper.ToDto).ToList()
                : null;
            var emblem = community.Emblem != null
                    ? MediaMapper.ToDto(community.Emblem)
                    : null;

            return new Community
                {
                    Id = community.Id,
                    Name = community.Name,
                    Description = community.Description,
                    Leader = UserMapper.ToDto(community.Leader),
                    IsDeleted = community.IsDeleted,
                    Members = members,
                    Posts = posts,
                    Emblem = emblem,
                    IsPrivate = community.IsPrivate,
                    CreatedBy = community.CreatedBy,
                    CreatedDate = community.CreatedDate,
                    ModifiedBy = community.ModifiedBy,
                    ModifiedDate = community.ModifiedDate
                };
        }
CommunityMapper