public KnowledgeBaseArticle KnowledgeBaseArticleCommunicationViewModel2KnowledgeBaseArticle(CommunicationItemKnowledgeBaseArticleViewModel viewModel) { KnowledgeBaseArticle retVal = new KnowledgeBaseArticle { AuthorName = viewModel.AuthorName, Body = viewModel.Body, Title = viewModel.Title, }; if (viewModel.Id != null) retVal.KnowledgeBaseArticleId = viewModel.Id; return retVal; }
public CommunicationItemKnowledgeBaseArticleViewModel KnowledgeBaseArticle2KnowledgeBaseArticleCommunicationViewModel(KnowledgeBaseArticle item) { CommunicationItemKnowledgeBaseArticleViewModel retVal = new CommunicationItemKnowledgeBaseArticleViewModel { //LastModified = item.LastModified, //Created = item.Created, AuthorId = item.AuthorId, AuthorName = item.AuthorName, Body = item.Body, Title = item.Title, Id = item.KnowledgeBaseArticleId }; if (item.Attachments != null) { foreach (var attachment in item.Attachments) { retVal.Attachments.Add(Attachment2CommunicationAttachment(attachment)); } } return retVal; }