public JsonNetResult UpdateNotifications(bool IsOptedIn, string Email)
        {
            var model = new AccountSummaryViewModel();
            var html = string.Empty;

            try
            {

                if (IsOptedIn)
                {
                    Exigo.SendEmailVerification(Identity.Customer.CustomerID, Email);
                    html = string.Format("{0}", Resources.Common.OptedInStatus);
                }
                else
                {
                    Exigo.OptOutCustomer(Identity.Customer.CustomerID);
                    html = string.Format("{0}", Resources.Common.OptedOutStatus);
                }

                return new JsonNetResult(new
                {
                    success = true,
                    action = "UpdateNotifications",
                    message = "We have sent a verification email to your email address on file. Click the link in the email and you will be opted in!",
                    html = html
                });

            }
            catch (Exception exception)
            {
                return new JsonNetResult(new
                {
                    success = false,
                    message = exception.Message + ": We apologize. We cannot opt you in at this time. Please try back later",
                    action = "UpdateNotfications"
                });
            }
        }
        public ActionResult Index()
        {
            var model = new AccountSummaryViewModel();

            var customer = Exigo.GetCustomer(Identity.Customer.CustomerID);

            model.CustomerID = customer.CustomerID;
            model.FirstName = customer.FirstName;
            model.LastName = customer.LastName;
            model.Email = customer.Email;
            model.LoginName = customer.LoginName;
            model.LanguageID = customer.LanguageID;

            model.PrimaryPhone = customer.PrimaryPhone;
            model.SecondaryPhone = customer.SecondaryPhone;
            model.MobilePhone = customer.MobilePhone;
            model.Fax = customer.Fax;
            model.Addresses = customer.Addresses;

            model.IsOptedIn = customer.IsOptedIn;

            if (Identity.Customer.CustomerTypeID == CustomerTypes.SmartShopper) {
                model.CustomerSite = new CustomerSite();
                model.CustomerSite = Exigo.GetCustomerSite(Identity.Customer.CustomerID);

                if (model.CustomerSite.WebAlias == null) {
                    model.CustomerSite.WebAlias = customer.CustomerID.ToString(); // WIN Requested this on 4/9/2015

                    // Update the customer web alias

                        var customerSiteRequest = new SetCustomerSiteRequest(customer);
                        customerSiteRequest.CustomerID = model.CustomerID;
                        customerSiteRequest.WebAlias = model.CustomerID.ToString();
                        customerSiteRequest.FirstName = model.FirstName;
                        customerSiteRequest.LastName = model.LastName;
                        SetCustomerSiteResponse res = Exigo.WebService().SetCustomerSite(customerSiteRequest);
                }
                else
                {
                    model.CustomerSite.WebAlias = model.CustomerSite.WebAlias;
                }
            }

            // Get the available languages
            model.Languages = Exigo.GetLanguages();

            return View(model);
        }