Exemplo n.º 1
0
        public bool SaveUserProfile(LocalUserModel profile)
        {
            var saveSucceeded = false;

            try
            {
                using (var db = new Entities())
                {
                    var tmpProfile = db.UserProfiles.Single(u => u.Id == profile.Id);
                    if (tmpProfile != null)
                    {
                        tmpProfile.Email = profile.Email;

                        db.SaveChanges();
                    }
                }

                saveSucceeded = true;
            }
            catch (Exception ex)
            {
                Logger.ErrorFormat("SaveProfile - error [{0}] - \r\n {1} \r\n\r\n", ex.Message, ex.StackTrace);
            }

            return(saveSucceeded);
        }
Exemplo n.º 2
0
        public LocalUserModel GetUserProfileAndMapToLocalUserModel()
        {
            var userModel = new LocalUserModel();

            var userProfile = GetUserProfileByName(HttpContext.Current.User.Identity.Name);

            if (userProfile != null)
            {
                userModel.Email = userProfile.Email;
                userModel.Id    = userProfile.Id;
            }

            return(userModel);
        }
Exemplo n.º 3
0
        public ActionResult SaveUserProfileData(LocalUserModel model)
        {
            if (ModelState.IsValid)
            {
                if (_userRepository.SaveUserProfile(model))
                {
                    TempData["Message"] = MessageIdEnum.ChangeUserProfileDataSuccess;
                    return(RedirectToAction("Manage"));
                }
            }

            TempData["Message"] = MessageIdEnum.ChangeUserProfileDataFailure;
            return(RedirectToAction("Manage"));
        }