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
};
}