public static Db.Community ToEntity(Community community)
{
if (community == null) return null;
var members = community.Members != null
? community.Members.Select(UserMapper.ToEntity).ToList()
: null;
var posts = community.Posts != null
? community.Posts.Select(PostMapper.ToEntity).ToList()
: null;
var emblem = community.Emblem != null
? (int?)community.Emblem.Id
: null;
return new Db.Community
{
Id = community.Id,
Name = community.Name,
Description = community.Description,
Members = members,
Posts = posts,
IsDeleted = community.IsDeleted,
LeaderUserId = community.Leader != null ? community.Leader.Id : 0,
Leader = null,
EmblemId = emblem,
IsPrivate = community.IsPrivate,
CreatedBy = community.CreatedBy,
CreatedDate = community.CreatedDate,
ModifiedBy = community.ModifiedBy,
ModifiedDate = community.ModifiedDate
};
}
}