Ejemplo n.º 1
0
 public ProductDetailResponse(Product product, ICollection <Interaction> interaction, int userId)
 {
     Id                    = product.Id;
     CompanyName           = product.Company.CompanyName;
     HoldingName           = product.Holding.HoldingName;
     ProductName           = product.ProductName;
     CategoryName          = product.Category.Category;
     Description           = product.Description;
     BusinessTarget        = product.BusinessTarget;
     Feature               = product.Feature;
     Benefit               = product.Benefit;
     Implementation        = product.Implementation;
     Faq                   = product.Faq;
     Certificate           = product.Certificate;
     IsPromoted            = product.IsPromoted;
     IsIncludePrice        = product.IsIncludePrice;
     PosterAsContact       = product.PosterAsContact;
     Currency              = product.Currency;
     Price                 = product.Price;
     Credentials           = product.Credentials;
     VideoPath             = product.VideoPath;
     Foto                  = product.FotoUpload.Where(x => x.UseCase.Equals("foto"));
     ProductCertificate    = product.FotoUpload.Where(x => x.UseCase.Equals("certificate"));
     ProductClient         = product.FotoUpload.Where(x => x.UseCase.Equals("client"));
     ProductImplementation = product.FotoUpload.Where(x => x.UseCase.Equals("implementationImage") || x.UseCase.Equals("implementationVideo"));
     Attachment            = product.AttachmentFile;
     Contact               = product.Contact == null ? null : new ProductContact(product.Contact);
     Poster                = new ProductContact(product.Poster);
     Interaction           = ProductMapping.InteractionMapping(interaction, userId);
     ContactEmail          = product.ContactEmail;
     ContactName           = product.ContactName;
     ContactHandphone      = product.ContactHandphone;
 }
Ejemplo n.º 2
0
 public ProductInteraction(ICollection <Interaction> interaction)
 {
     TotalLike    = interaction.Count(x => x.IsLike == true);
     TotalChat    = interaction.Count(x => x.IsChat == true);
     TotalComment = interaction.Count(x => x.IsComment == true);
     TotalView    = interaction.Count(x => x.IsViewed == true);
     IsLike       = false;
     Comment      = ProductMapping.CommentMapping(interaction.Where(x => x.IsComment == true).ToList());
 }
Ejemplo n.º 3
0
        public static IEnumerable <ProductResponse> ListResponseMapping(List <Product> product, int?id)
        {
            if (product == null)
            {
                return(null);
            }
            List <ProductResponse> products = new List <ProductResponse> ();

            foreach (var item in product)
            {
                products.Add(ProductMapping.ResponseMapping(item, id));
            }
            return(products);
        }