public static Comment MapToEntity(CommentDetailModel commentDetailModel) { return(new Comment { Id = commentDetailModel.Id, Author = UserMapper.MapListModelToEntity(commentDetailModel.Author), BelongsTo = PostMapper.MapListModelToEntity(commentDetailModel.BelongsTo), CreationTime = commentDetailModel.CreationTime, Content = commentDetailModel.Content }); }
public static Activity MapToEntity(ActivityDetailModel activityDetailModel) { if (activityDetailModel.GetType() == typeof(CommentDetailModel)) { return(CommentMapper.MapToEntity((CommentDetailModel)activityDetailModel)); } if (activityDetailModel.GetType() == typeof(PostListModel)) { return(PostMapper.MapListModelToEntity((PostListModel)activityDetailModel)); } if (activityDetailModel.GetType() == typeof(PostDetailModel)) { return(PostMapper.MapDetailModelToEntity((PostDetailModel)activityDetailModel)); } throw new Exception("Invalid activity model to map!"); }