Esempio n. 1
0
        public async Task <ActionResult> Contact(AgentSettingsContactViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _authManager.FindByIdAsync(User.Identity.GetUserId());

                user.FirstName         = model.FirstName;
                user.LastName          = model.LastName;
                user.PhoneNumber       = model.PhoneNumber1;
                user.PhoneNumber2      = model.PhoneNumber2;
                user.Skype             = model.Skype;
                user.Gender            = model.SelectedGender;
                user.Title             = model.Title;
                user.SalutationMessage = model.SalutationMessage;
                user.AddressAddOn      = model.AddressAddOn;
                user.EmailPrivate      = model.EmailPrivate;
                user.EmailOther        = model.EmailOther;
                user.EmailFeedBack     = model.EmailFeedBack;
                user.PhoneDirectAccess = model.PhoneDirectAccess;
                user.PhoneFax          = model.PhoneFax;
                user.PhonePrivate      = model.PhonePrivate;
                user.OtherPhone        = model.OtherPhone;
                user.Url               = model.Url;
                user.FreeTextArray     = model.FreeTextArray;
                user.ApprovalOfAddress = model.ApprovalOfAddress;
                user.SalutationType    = model.SalutationType;
                var result = await _authManager.UpdateAsync(user);

                if (result.Succeeded)
                {
                    return(RedirectToAction(nameof(Index)));
                }
            }
            return(View(model));
        }
Esempio n. 2
0
        public async Task <ActionResult> Contact()
        {
            var user = await _authManager.FindByIdAsync(User.Identity.GetUserId());

            AgentSettingsContactViewModel model = new AgentSettingsContactViewModel();

            model.Genders = Enum.GetValues(typeof(Gender)).Cast <Gender>()
                            .Select(c => new SelectListItem {
                Value = c.ToString(), Text = c.GetDisplayName()
            })
                            .ToList();
            model.ProgressPercentage = 25;
            model.Message            = Resource.Agent_Home_EditUserInformations;
            model.FirstName          = user.FirstName;
            model.LastName           = user.LastName;
            model.SelectedGender     = user.Gender;
            model.PhoneNumber1       = user.PhoneNumber;
            model.PhoneNumber2       = user.PhoneNumber2;
            model.Email             = user.Email;
            model.Skype             = user.Skype;
            model.Title             = user.Title;
            model.SalutationMessage = user.SalutationMessage;
            model.AddressAddOn      = user.AddressAddOn;
            model.EmailPrivate      = user.EmailPrivate;
            model.EmailOther        = user.EmailOther;
            model.EmailFeedBack     = user.EmailFeedBack;
            model.PhoneDirectAccess = user.PhoneDirectAccess;
            model.PhoneFax          = user.PhoneFax;
            model.PhonePrivate      = user.PhonePrivate;
            model.OtherPhone        = user.OtherPhone;
            model.Url               = user.Url;
            model.FreeTextArray     = user.FreeTextArray;
            model.ApprovalOfAddress = user.ApprovalOfAddress.GetValueOrDefault();
            model.SalutationType    = user.SalutationType;

            return(View(model));
        }