コード例 #1
0
 public PostDisplay(Post post)
 {
     Published          = post.Published.GetValueOrDefault(DateTime.MinValue);
     LocalPublishedDate = Published.ToLongDateString(); //TODO: To local time
     Slug          = post.Slug;
     Comments      = post.GetComments().OrderBy(c => c.Published).Select(c => new CommentDisplay(c));
     CommentsCount = post.GetComments().Count();
     Title         = post.Title;
     Body          = post.Body;
     Tags          = post.GetTags().OrderByDescending(t => t.CreatedDate).Select(t => new TagDisplay(t)); //TODO: this (OrderByDescending) is business logic and needs to be moved outta here most likely
     User          = post.User;
     DateValue     = Convert.ToInt32((Published.Day + Published.Month + Published.Hour) * Published.Minute);
 }