public static PostModel ToModel(Post postEntity)
{
PostModel postModel = new PostModel()
{
ID = postEntity.ID,
Title = postEntity.Title,
Text = postEntity.Text,
PostDate = postEntity.PostDate,
Author = postEntity.Author.DisplayName
};
foreach (var commentEntity in postEntity.Comments)
{
postModel.Comments.Add(CommentsMapper.ToModel(commentEntity));
}
foreach (var tag in postEntity.Tags)
{
postModel.Tags.Add(tag.Name);
}
return postModel;
}