public ActionResult SaveContactInfo(DataAccess.Models.ProductDetail.Advisor.AdvisorContactInfo model)
 {
     if (ModelState.IsValidField("AdvisorMasterEntityId"))
     {
         var isValid = AdvisorViewManager.ValidateProfileAddresses(model, ModelState);
         if (!isValid)
         {
             var thePartial = PartialView("EditorTemplates/ContactInfo", model);
             Response.StatusCode = (int)HttpStatusCode.PartialContent;
             return(thePartial);
         }
         else
         {
             var success = AdvisorContactInfoManager.SaveContactInfo(FederatedLoginClient.User.UserMasterEntityId, model);
             if (success)
             {
                 ProfileAddressManager.UpdateListForNewCity(model.Addresses);
                 return(new HttpStatusCodeResult(HttpStatusCode.OK));
             }
             else
             {
                 return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError));
             }
         }
     }
     else
     {
         // no MEID can't deal...
         return(new HttpNotFoundResult());
     }
 }
        public ActionResult ContactInfoEditor(DataAccess.Models.ProductDetail.Advisor.AdvisorContactInfo model)
        {
            switch (model.ItemTypeToAdd)
            {
            case ProfileItemType.Phone:
                model.PhoneNumbers = model.PhoneNumbers ?? new List <ProfilePhoneNumber>();
                model.PhoneNumbers.Add(new ProfilePhoneNumber {
                    Status = ProfileItemStatus.Insert
                });
                break;

            case ProfileItemType.Email:
                model.EmailAddresses = model.EmailAddresses ?? new List <ProfileEmailAddress>();
                model.EmailAddresses.Add(new ProfileEmailAddress {
                    Status = ProfileItemStatus.Insert
                });
                break;

            case ProfileItemType.Website:
                model.WebSites = model.WebSites ?? new List <ProfileWebSite>();
                model.WebSites.Add(new ProfileWebSite {
                    Status = ProfileItemStatus.Insert, EntityType = model.EntityType
                });
                break;

            case ProfileItemType.Messenger:
                model.Messengers = model.Messengers ?? new List <ProfileInstantMessenger>();
                model.Messengers.Add(new ProfileInstantMessenger {
                    Status = ProfileItemStatus.Insert, EntityType = model.EntityType
                });
                break;

            case ProfileItemType.Address:
                model.Addresses = model.Addresses ?? new List <ProfileAddress>();
                model.Addresses.Add(new ProfileAddress {
                    Status = ProfileItemStatus.Insert
                });
                break;

            default:
                ProfileAddressManager.DisambiguateAddressCity(model.PrimaryAddress, true);
                ProfileAddressManager.DisambiguateAddressCities(model.Addresses, true);
                this.ModelState.Clear();        // prevent Html helper from using unaltered (ambiguous) address cities
                break;
            }

            return(PartialView("EditorTemplates/ContactInfo", model));
        }