public ActionResult AdminEventBadgeUpdate(AdvisorInformationViewModel viewModel)
        {
            if (viewModel.Badge == null || !viewModel.Badge.DirtyFlag) //if nothing has changed don't need to go any further
            {
                return(new HttpStatusCodeResult(HttpStatusCode.OK));
            }
            viewModel.LoadSecurity("advisors-admininformationupdate", viewModel);
            //ignore errors for non-badge related fields
            tcchc.ValidationHelper.IgnoreValidationExceptFor(ModelState, "Badge.Company", "Badge.Name", "Badge.NickName", "Badge.Location");

            if (ModelState.IsValid)
            {
                var success = AdvisorInfoManager.SaveEventBadgeInfo(FederatedLoginClient.User.UserMasterEntityId, viewModel.AdvisorInformation);
                return(new HttpStatusCodeResult(success ? HttpStatusCode.OK : HttpStatusCode.InternalServerError));
            }
            else
            {
                // Validation error(s) detected on the server side
                var partialView = PartialView("EditorTemplates/Admin.EventBadge", viewModel);
                Response.StatusCode = (int)HttpStatusCode.PartialContent;
                return(partialView);
            }
        }
        public ActionResult AdminInformationUpdate(AdvisorInformationViewModel viewModel)
        {
            viewModel.LoadSecurity("advisors-admininformationupdate", viewModel);

            // no validation on DBA if not IC
            var editIdType = viewModel.CanView(SecurityConstants.Advisor.EditAdvisorIdType);

            if (viewModel.AdvisorType.TypeId != AdvisorInfoManager.IndependentContractorTypeId && ModelState.ContainsKey("AdvisorDoingBusinessAs"))
            {
                ModelState["AdvisorDoingBusinessAs"].Errors.Clear();
            }

            // no validate on Type for self-edit
            if (!editIdType && ModelState.ContainsKey("AdvisorType.TypeId"))
            {
                ModelState["AdvisorType.TypeId"].Errors.Clear();
            }

            // no validate AdvisorID for self-edit
            if (!editIdType && viewModel.ListAdvisorIds.IsNotNullOrEmpty())
            {
                for (int i = 0; i < viewModel.ListAdvisorIds.Count; i++)
                {
                    var name = string.Format("ListAdvisorIds[{0}].Id", i);
                    if (ModelState.ContainsKey(name))
                    {
                        ModelState[name].Errors.Clear();
                    }
                }
            }

            if (ModelState.ContainsKey("SellingTravelSince"))
            {
                ModelState["SellingTravelSince"].Errors.Clear();
            }

            if (ModelState.ContainsKey("Badge.Company"))
            {
                ModelState["Badge.Company"].Errors.Clear();
            }
            if (ModelState.ContainsKey("Badge.Name"))
            {
                ModelState["Badge.Name"].Errors.Clear();
            }
            if (ModelState.ContainsKey("Badge.NickName"))
            {
                ModelState["Badge.NickName"].Errors.Clear();
            }
            if (ModelState.ContainsKey("Badge.Location"))
            {
                ModelState["Badge.Location"].Errors.Clear();
            }

            var isValid = ModelState.IsValid && AdvisorViewManager.ValidateAdvisorIds(viewModel, ModelState);

            if (isValid)
            {
                var userMasterEntityId = FederatedLoginClient.User.UserMasterEntityId;
                var success            = AdvisorInfoManager.SaveAdminInfo(userMasterEntityId, viewModel.AdvisorInformation, editIdType);
                return(new HttpStatusCodeResult(success ? HttpStatusCode.OK : HttpStatusCode.InternalServerError));
            }
            else
            {
                // Validation error(s) detected on the server side
                var partialView = PartialView("EditorTemplates/Admin.AdvisorInformation", viewModel);
                Response.StatusCode = (int)HttpStatusCode.PartialContent;
                return(partialView);
            }
        }