Esempio n. 1
0
        public static ProductDetailResponse FromData(Product entity, ICollection <Interaction> interaction)
        {
            if (entity == null)
            {
                return(null);
            }
            var response = new ProductDetailResponse()
            {
                Id             = entity.Id,
                CompanyName    = entity.Company.CompanyName,
                HoldingName    = entity.Holding.HoldingName,
                ProductName    = entity.ProductName,
                CategoryName   = entity.Category.Category,
                Description    = entity.Description,
                IsIncludePrice = entity.IsIncludePrice,
                Price          = entity.Price,
                Credentials    = entity.Credentials,
                VideoPath      = entity.VideoPath,
                FotoPath       = null,
                Contact        = ProductContact.FromData(entity.User),
                Interaction    = ProductInteraction.FromData(interaction, entity.UserId),
            };

            if (entity.FotoUpload.LastOrDefault() != null)
            {
                response.FotoPath = entity.FotoUpload.LastOrDefault().FotoPath;
            }

            return(response);
        }
Esempio n. 2
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;
 }
Esempio n. 3
0
        public static ProductContact FromData(MUser user)
        {
            var productContact = new ProductContact()
            {
                Name       = user.Name,
                Email      = user.Email,
                JobTitle   = user.JobTitle,
                Occupation = user.Occupation,
                Handphone  = user.Handphone,
                Address    = user.Address,
                Foto       = "",
            };

            return(productContact);
        }