Exemplo n.º 1
0
        public ActionResult CreateContact(Customer customer, PortalUser portalUser)
        {
            var httpClient      = GetHttpClient();
            var retailPriceList = PriceListService.QueryDefaultPriceList(httpClient);

            if (retailPriceList != null)
            {
                customer.PriceListId = retailPriceList.Id;
            }

            var customerId = CustomerService.CreateContact(httpClient, customer);

            portalUser.CustomerId = customerId;
            portalUser.Name       = customer.Firstname + " " + customer.Lastname;

            var portalUserId = PortalUserService.CreatePortalUser(httpClient, portalUser, (int)CustomerType.Contact);

            return(Json(portalUserId, JsonRequestBehavior.AllowGet));
        }