コード例 #1
0
        private NewsListViewModel ToNewsListViewModel(NewsItem[] newsItems)
        {
            var newsViewModel = new NewsListViewModel();
            newsViewModel.List = newsItems.Select
            (
                x => ToNewsItemViewModel(x)
            )
            .ToArray();

            return newsViewModel;
        }
コード例 #2
0
 private NewsItemViewModel ToNewsItemViewModel(NewsItem newsItem)
 {
     return new NewsItemViewModel
     {
         Id = newsItem.Id,
         Headline = newsItem.Headline,
         DateTime = newsItem.DateTime,
         Body = newsItem.Body,
         Type = newsItem.Type,
         TypeId = newsItem.TypeId
     };
 }