Exemplo n.º 1
0
        public static void Run()
        {
            var addressmapper                = new AddressProfile();
            var categorymapper               = new CategoryProfile();
            var customermapper               = new CustomerProfile();
            var customerRolemapper           = new CustomerRoleProfile();
            var manufacturermapper           = new ManufacturerProfile();
            var picturemapper                = new PictureProfile();
            var productAttributemapper       = new ProductAttributeProfile();
            var productmapper                = new ProductProfile();
            var specificationAttributemapper = new SpecificationAttributeProfile();
            var tierPricemapper              = new TierPriceProfile();

            var config = new MapperConfiguration(cfg => {
                cfg.AddProfile(addressmapper.GetType());
                cfg.AddProfile(categorymapper.GetType());
                cfg.AddProfile(customermapper.GetType());
                cfg.AddProfile(customerRolemapper.GetType());
                cfg.AddProfile(manufacturermapper.GetType());
                cfg.AddProfile(picturemapper.GetType());
                cfg.AddProfile(productAttributemapper.GetType());
                cfg.AddProfile(productmapper.GetType());
                cfg.AddProfile(specificationAttributemapper.GetType());
                cfg.AddProfile(tierPricemapper.GetType());
            });

            AutoMapperConfiguration.Init(config);
        }
Exemplo n.º 2
0
        public static async Task <IActionResult> Run(
            [HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
            ILogger log)
        {
            log.LogInformation("ParseContactAddress function Started");
            try
            {
                string     requestBody = await new StreamReader(req.Body).ReadToEndAsync();
                AdviserCRM data        = JsonConvert.DeserializeObject <AdviserCRM>(requestBody);

                AddressProfile profile = new AddressProfile();
                if (!String.IsNullOrEmpty(data.account.address1_composite))
                {
                    profile.MailingAddress = new Address()
                    {
                        Addressee     = data.agency.fdl_addresscommsto,
                        AddressLine1  = data.contact.address1_line1,
                        AddressLine2  = data.contact.address1_line2,
                        Country       = data.contact.address1_country,
                        PostCode      = data.contact.address1_postalcode,
                        Suburb        = data.contact.address1_line3,
                        TownCity      = data.contact.address1_city,
                        AddressStatus = "Active",
                        StartDate     = Convert.ToDateTime(data.contact.createdon).ToString("dd/MM/yyyy")
                    };
                }

                if (!String.IsNullOrEmpty(data.account.address2_composite))
                {
                    profile.PhysicalAddress = new Address()
                    {
                        AddressLine1  = data.contact.address2_line1,
                        AddressLine2  = data.contact.address2_line2,
                        Country       = data.contact.address2_country,
                        PostCode      = data.contact.address2_postalcode,
                        Suburb        = data.contact.address2_line3,
                        TownCity      = data.contact.address2_city,
                        AddressStatus = "Active",
                        StartDate     = Convert.ToDateTime(data.contact.createdon).ToString("dd/MM/yyyy")
                    };
                }

                return((ActionResult) new OkObjectResult(profile));
            }
            catch (Exception ex)
            {
                return(new BadRequestObjectResult(String.Format("An error occurred processing this request. See detailes below\r\n{0}", ex.Message)));
            }
        }
Exemplo n.º 3
0
        public PortfolioControllerTests()
        {
            var portfolioProfile = new PortfolioProfile();
            var propertyProfile  = new PropertyProfile();
            var addressProfile   = new AddressProfile();
            var config           = new MapperConfiguration(cfg =>
            {
                cfg.AddProfile(portfolioProfile);
                cfg.AddProfile(propertyProfile);
                cfg.AddProfile(addressProfile);
            });

            _mapper = new Mapper(config);

            _user = new ClaimsPrincipal(new ClaimsIdentity(new Claim[] { new Claim(ClaimTypes.NameIdentifier, "SomeValueHere"), new Claim(ClaimTypes.Name, "*****@*****.**") }, "Owner"));
        }