Esempio n. 1
0
        public async Task <ActionResult> Social()
        {
            var user = await _authManager.FindByIdAsync(User.Identity.GetUserId());

            var model = new AgentSettingsSocialViewModel();

            model.Facebook           = string.IsNullOrEmpty(user.Facebook)?"": user.Facebook;
            model.Twitter            = string.IsNullOrEmpty(user.Twitter)? "" : user.Twitter;
            model.Linkedin           = string.IsNullOrEmpty(user.Linkedin)?"" : user.Linkedin;
            model.GooglePlus         = string.IsNullOrEmpty(user.GooglePlus) ? "" : user.GooglePlus;
            model.ProgressPercentage = 50;
            model.Message            = Resource.Agent_Home_EditUserSocialInformations;
            return(View(model));
        }
Esempio n. 2
0
        public async Task <ActionResult> Social(AgentSettingsSocialViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = await _authManager.FindByIdAsync(User.Identity.GetUserId());

                user.Facebook   = model.Facebook;
                user.Twitter    = model.Twitter;
                user.Linkedin   = model.Linkedin;
                user.GooglePlus = model.GooglePlus;

                var result = await _authManager.UpdateAsync(user);

                if (result.Succeeded)
                {
                    return(RedirectToAction(nameof(Index)));
                }
            }
            return(View(model));
        }