コード例 #1
0
ファイル: DalArticleMapper.cs プロジェクト: f-acepalm/Blog
 public static void CopyFieldsTo(this DalArticle source, Article target)
 {
     if (source == null)
     {
         throw new ArgumentNullException("source");
     }
     if (target == null)
     {
         throw new ArgumentNullException("target");
     }
     target.Title = source.Title;
     target.Text = source.Text;
     target.BlogId = source.BlogId;
 }
コード例 #2
0
        public static Article ToModel(this DalArticleEntity item)
        {
            if (item == null)
                return null;

            Article articleEntity = new Article
            {
                Id = item.Id,
                Name = item.Name,
                BlogId = item.Blog.Id,
                Text = item.Text,
                Date = item.Date
            };
            return articleEntity;
        }