Example #1
0
        public static ProductDetailsDto Build(Product product)
        {
            var commentDtos = new List <CommentDetailsDto>();

            if (product.Comments != null)
            {
                foreach (var comment in product.Comments)
                {
                    commentDtos.Add(CommentDetailsDto.Build(comment));
                }
            }

            return(new ProductDetailsDto
            {
                Id = product.Id,
                Name = product.Name,
                Slug = product.Slug,
                Description = product.Description,
                PublishedAt = product.PublishAt,
                Comments = commentDtos,
                Tags = TagOnlyNameDto.BuildAsStringList(product.ProductTags),
                Categories = CategoryOnlyNameDto.BuildAsStringList(product.ProductCategories),
                ImageUrls = product.ProductImages.Select(pi => pi.FilePath)
            });
        }
Example #2
0
 public static ArticleSummaryDto Build(Entities.Article article)
 {
     return(new ArticleSummaryDto
     {
         Id = article.Id,
         Title = article.Title,
         Slug = article.Slug,
         Description = article.Description,
         CommentsCount = article.CommentsCount,
         Categories = CategoryOnlyNameDto.BuildAsStringList(article.ArticleCategories),
         User = UserBasicEmbeddedInfoDto.Build(article.User),
         Tags = TagOnlyNameDto.BuildAsStringList(article.ArticlesTags),
         PublishAt = article.PublishedOn,
         UpdatedAt = article.UpdatedAt
     });
 }
 public static ProductSummaryDto Build(Product product)
 {
     return(new ProductSummaryDto
     {
         Id = product.Id,
         Name = product.Name,
         Slug = product.Slug,
         Price = product.Price,
         Stock = product.Stock,
         CommentsCount = product.CommentsCount,
         Categories = CategoryOnlyNameDto.BuildAsStringList(product.ProductCategories),
         Tags = TagOnlyNameDto.BuildAsStringList(product.ProductTags),
         ImageUrls = product.ProductImages.Select(pi => pi.FilePath),
         PublishAt = product.PublishAt,
     });
 }
        public static ArticleDetailsDto Build(Entities.Article article)
        {
            var commentDtos = new List <CommentDetailsDto>();

            foreach (var comment in article.Comments)
            {
                commentDtos.Add(CommentDetailsDto.Build(comment));
            }

            return(new ArticleDetailsDto
            {
                Id = article.Id,
                Slug = article.Slug,
                Title = article.Slug,
                Body = article.Body,
                PublishedAt = article.PublishedOn,
                Comments = commentDtos,
                User = UserBasicEmbeddedInfoDto.Build(article.User),
                Tags = TagOnlyNameDto.BuildAsStringList(article.ArticlesTags),
                Categories = CategoryOnlyNameDto.BuildAsStringList(article.ArticleCategories),
            });
        }