PostContent GetPostContentImage(ContentImageVm srcModel, PostContent dstModel) { PostContent result = Mapper.Map<ContentImageVm, PostContent>(srcModel, dstModel); result.ContentData = srcModel.ContentData; return result; }
PostContent GetPostContentText(ContentTextVm srcModel, PostContent dstModel) { PostContent result = Mapper.Map<ContentTextVm, PostContent>(srcModel, dstModel); UnicodeEncoding encoding = new UnicodeEncoding(); result.ContentData = encoding.GetBytes(srcModel.ContentData); return result; }
private PostContent GetPostContent(IContentType Content) { PostContent PostContent = new PostContent(); switch (Content.ContentDataType) { case ContentTypeEnums.Text: PostContent = GetPostContentText(Content as ContentTextVm , PostContent); break; case ContentTypeEnums.Image: PostContent = GetPostContentImage(Content as ContentImageVm , PostContent); break; case ContentTypeEnums.Sound: break; case ContentTypeEnums.Video: break; default: throw new NotImplementedException("Unknown content type: " + Content.ContentDataType); } return PostContent; }