Exemplo n.º 1
0
        public async Task <IActionResult> CompleteProfile(CompleteProfileViewModel model)
        {
            ViewData["ReturnUrl"] = Url.Action();

            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var oktaUserId = User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier)?.Value;

            if (string.IsNullOrEmpty(oktaUserId))
            {
                // Need to display a user-friendly error view
                throw new NotImplementedException("Todo: error view. Could not look up Okta user (this shouldn't happen)");
            }

            try
            {
                var user = await _oktaClient.Users.GetUserAsync(oktaUserId);

                user.Profile["rewardsNumber"] = model.RewardsNumber;
                await user.UpdateAsync();
            }
            catch (OktaApiException oaex)
            {
                // Redisplay form with error message
                model.Error = oaex.ErrorSummary;
                return(View(model));
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 2
0
        public async Task <ActionResult> CompleteProfile(CompleteProfileViewModel model)
        {
            if (ModelState.IsValid)
            {
                return(RedirectToAction("SelectPlan", "Account"));
            }

            return(View(model));
        }
        public static List<PartnershipStateInfoViewModel> GetAllPartnershipsByOrganizationAccountKey(string organizationAccountKey)
        {
            IEnumerable<PartnershipStateInfoDTO> partnerships = OrganizationAccountRepository.GetAllPartnershipsByOrganizationAccountKey(new Guid(organizationAccountKey));

            List<PartnershipStateInfoViewModel> result = new List<PartnershipStateInfoViewModel>();

            foreach (PartnershipStateInfoDTO item in partnerships)
            {
                PartnershipStateInfoViewModel itemview = new PartnershipStateInfoViewModel();

                BasicProfileViewModel senderBasicProfile = new BasicProfileViewModel();
                senderBasicProfile.ReferenceKey = item.Sender.Key.ToString();
                senderBasicProfile.AccountType = AccountType.OrganizationAccount;
                CompleteProfileViewModel senderCompleteProfile = new CompleteProfileViewModel();
                senderCompleteProfile.BasicProfile = senderBasicProfile;

                BasicProfileViewModel receiverBasicProfile = new BasicProfileViewModel();
                receiverBasicProfile.ReferenceKey = item.Receiver.Key.ToString();
                receiverBasicProfile.AccountType = AccountType.OrganizationAccount;
                CompleteProfileViewModel receiverCompleteProfile = new CompleteProfileViewModel();
                receiverCompleteProfile.BasicProfile = receiverBasicProfile;

                //if you are the receiver you only need info from the sender
                //if you are the sender you only need info from the receiver

                if (item.Receiver.Key.ToString() == organizationAccountKey)
                {
                    senderCompleteProfile.BasicProfile.ReferenceKey = item.Sender.Key.ToString();
                    senderCompleteProfile.BasicProfile.AccountType = AccountType.OrganizationAccount;
                    senderCompleteProfile.FullName = item.Sender.Name;
                    senderCompleteProfile.Description1 = item.Sender.Description;
                    senderCompleteProfile.Description2 = item.Sender.Organization.Name;

                }
                else
                {
                    receiverCompleteProfile.BasicProfile.ReferenceKey = item.Receiver.Key.ToString();
                    receiverCompleteProfile.BasicProfile.AccountType = AccountType.OrganizationAccount;
                    receiverCompleteProfile.FullName = item.Receiver.Name;
                    receiverCompleteProfile.Description1 = item.Receiver.Description;
                    receiverCompleteProfile.Description2 = item.Receiver.Organization.Name;
                }

                itemview.Receiver = receiverCompleteProfile;
                itemview.Sender = senderCompleteProfile;
                itemview.PartnershipAction = item.Action;
                //itemview.ReceiverEmail = item.Receiver.Email;
                //itemview.SenderEmail = item.Sender.Email;
                result.Add(itemview);
            }

            return result;
        }
Exemplo n.º 4
0
        public CompleteYourProfilePage()
        {
            InitializeComponent();

            BindingContext = viewModel = new CompleteProfileViewModel();
        }
Exemplo n.º 5
0
        public ActionResult CompleteProfile()
        {
            var model = new CompleteProfileViewModel();

            return(View(model));
        }
Exemplo n.º 6
0
 public static CompleteProfileView ConvertFromViewModelToView(CompleteProfileViewModel model)
 {
     return new CompleteProfileView { BasicProfile = new BasicProfileView { ReferenceKey= model.BasicProfile.ReferenceKey , AccountType=model.BasicProfile.AccountType  }, FullName=model.FullName, Description1=model.Description1 , Description2=model.Description2  };
 }
        public static PartnershipStateInfoViewModel GetPartnershipBetweenOrganizationAccountsByKeys(string organizationAccountKey1, string organizationAccountKey2)
        {
            PartnershipStateInfo partnership = OrganizationAccountRepository.GetPartnershipBetweenOrganizationAccounts(new Guid(organizationAccountKey1), new Guid(organizationAccountKey2));
            PartnershipStateInfoViewModel result = new PartnershipStateInfoViewModel();

            if (partnership != null)
            {

                PartnershipStateInfoViewModel itemview = new PartnershipStateInfoViewModel();
                BasicProfileViewModel senderBasicProfile = new BasicProfileViewModel();
                senderBasicProfile.ReferenceKey = partnership.Sender.Key.ToString();
                senderBasicProfile.AccountType = AccountType.OrganizationAccount;
                CompleteProfileViewModel senderCompleteProfile = new CompleteProfileViewModel();
                senderCompleteProfile.BasicProfile = senderBasicProfile;

                senderCompleteProfile.FullName = partnership.Sender.Name;
                senderCompleteProfile.Description1 = partnership.Sender.Description;
                senderCompleteProfile.Description2 = partnership.Sender.Organization.Name;

                BasicProfileViewModel receiverBasicProfile = new BasicProfileViewModel();
                receiverBasicProfile.ReferenceKey = partnership.Receiver.Key.ToString();
                receiverBasicProfile.AccountType = AccountType.UserAccount;

                CompleteProfileViewModel receiverCompleteProfile = new CompleteProfileViewModel();
                receiverCompleteProfile.BasicProfile = receiverBasicProfile;

                receiverCompleteProfile.FullName = partnership.Receiver.Name;
                receiverCompleteProfile.Description1 = partnership.Receiver.Description;
                receiverCompleteProfile.Description2 = partnership.Receiver.Organization.Name;

                result.ActionDateTime = partnership.ActionDateTime;
                result.PartnershipAction = partnership.Action;
                // result.ReceiverEmail = friendship.Receiver.Email;
                //result.SenderEmail = friendship.Sender.Email;
            }
            else
            {
                result.PartnershipAction = PartnershipAction.New;
            }
            return result;
        }
        public static CompleteProfileViewModel GetOrganizationAccountProfileByEmployeeUserAccountKey(string userAccountKey)
        {
            CompleteProfileViewModel result = new CompleteProfileViewModel();

            CompleteProfile thisProfile = OrganizationAccountRepository.GetOrganizationAccountProfileByEmployeeUserAccountKey(new Guid(userAccountKey));

            result.BasicProfile = new BasicProfileViewModel { ReferenceKey=thisProfile.BasicProfile.ReferenceKey.ToString(), AccountType=thisProfile.BasicProfile.ReferenceType  };
            result.FullName = thisProfile.FullName;
            result.Description1 = thisProfile.Description1;
            result.Description2 = thisProfile.Description2;

            return result;
        }