Example #1
0
        // TODO: this and some other stuff probably belongs in ProfileService
        public void EditUserProfile(User user, UserEditProfile userEditProfile)
        {
            var profile = _profileRepository.GetProfile(user.UserID);

            if (profile == null)
            {
                throw new Exception(String.Format("No profile found for UserID {0}", user.UserID));
            }
            profile.IsSubscribed     = userEditProfile.IsSubscribed;
            profile.ShowDetails      = userEditProfile.ShowDetails;
            profile.IsPlainText      = userEditProfile.IsPlainText;
            profile.HideVanity       = userEditProfile.HideVanity;
            profile.TimeZone         = userEditProfile.TimeZone;
            profile.IsDaylightSaving = userEditProfile.IsDaylightSaving;
            profile.Signature        = _textParsingService.ForumCodeToHtml(userEditProfile.Signature);
            profile.Location         = userEditProfile.Location;
            profile.Dob            = userEditProfile.Dob;
            profile.Web            = userEditProfile.Web;
            profile.Aim            = userEditProfile.Aim;
            profile.Icq            = userEditProfile.Icq;
            profile.YahooMessenger = userEditProfile.YahooMessenger;
            profile.Facebook       = userEditProfile.Facebook;
            profile.Twitter        = userEditProfile.Twitter;
            _profileRepository.Update(profile);
        }
Example #2
0
        public ApplicationResult UpdateUserProfile(UserEditProfile model, string userId)
        {
            var user = _userRepository.GetById(userId);

            if (user == null)
            {
                return(ApplicationResult.Fail("User does not found"));
            }
            Mapper.Map(model, user);
            _userRepository.Update(user);
            return(ApplicationResult.Ok(Mapper.Map <UserViewProfile>(user)));
        }
Example #3
0
        public ViewResult EditProfile(UserEditProfile userEdit)
        {
            var user = _userRetrievalShim.GetUser(HttpContext);

            if (user == null)
            {
                return(View("EditAccountNoUser"));
            }
            _userService.EditUserProfile(user, userEdit);
            ViewBag.Result = Resources.ProfileUpdated;
            return(View(userEdit));
        }
Example #4
0
        public ViewResult EditProfile(UserEditProfile userEdit)
        {
            var user = this.CurrentUser();

            if (user == null)
            {
                return(View("EditAccountNoUser"));
            }
            _userService.EditUserProfile(user, userEdit);
            ViewBag.Result = Resources.ProfileUpdated;
            return(View(userEdit));
        }
Example #5
0
 /// <summary>
 /// Changes the Profile information
 /// </summary>
 /// <param name="Edits">the new profile information</param>
 /// <returns>the page or dash board</returns>
 public ActionResult ChangeProfile(UserEditProfile Edits)
 {
     if (ModelState.IsValid)
     {
         ObjectParameter ErrorMessage = new ObjectParameter("ErrorMessage", typeof(string));
         int MyError = DB.UpdateTheUserInfo(int.Parse(Session["SessionUserID"] as string), null, null, null, Edits.HomePhone, Edits.CellPhone, Edits.WorkPhone, ErrorMessage);
         ViewBag.ErrorMessage = ErrorMessage.Value as string;
         if (MyError > 0)
             return RedirectToAction("Index", "Dashboard");
     }
     return View(Edits);
 }
Example #6
0
        public ViewResult EditProfile()
        {
            var user = _userRetrievalShim.GetUser(HttpContext);

            if (user == null)
            {
                return(View("EditAccountNoUser"));
            }
            var profile  = _profileService.GetProfileForEdit(user);
            var userEdit = new UserEditProfile(profile);

            return(View(userEdit));
        }
Example #7
0
        public ViewResult EditProfile()
        {
            var user = this.CurrentUser();

            if (user == null)
            {
                return(View("EditAccountNoUser"));
            }
            var profile  = _profileService.GetProfileForEdit(user);
            var userEdit = new UserEditProfile(profile);

            return(View(userEdit));
        }
Example #8
0
        public async Task <ViewResult> EditProfile(UserEditProfile userEdit)
        {
            var user = _userRetrievalShim.GetUser();

            if (user == null)
            {
                return(View("EditAccountNoUser"));
            }
            await _userService.EditUserProfile(user, userEdit);

            ViewBag.Result = Resources.ProfileUpdated;
            return(View(userEdit));
        }
Example #9
0
        public async Task <ViewResult> EditProfile()
        {
            var user = _userRetrievalShim.GetUser();

            if (user == null)
            {
                return(View("EditAccountNoUser"));
            }
            var profile = await _profileService.GetProfileForEdit(user);

            var userEdit = new UserEditProfile(profile);

            return(View(userEdit));
        }
        public void EditProfile()
        {
            var controller    = GetController();
            var contextHelper = new HttpContextHelper();

            controller.ControllerContext = new ControllerContext(contextHelper.MockContext.Object, new RouteData(), controller);
            var user = UserTest.GetTestUser();

            controller.SetUser(user);
            var userEdit = new UserEditProfile();
            var result   = controller.EditProfile(userEdit);

            _userService.Verify(u => u.EditUserProfile(user, userEdit), Times.Once());
            Assert.IsNotNullOrEmpty(result.ViewData["Result"].ToString());
        }
Example #11
0
        // TODO: this and some other stuff probably belongs in ProfileService
        public async Task EditUserProfile(User user, UserEditProfile userEditProfile)
        {
            var profile = await _profileRepository.GetProfile(user.UserID);

            if (profile == null)
            {
                throw new Exception($"No profile found for UserID {user.UserID}");
            }
            profile.IsSubscribed     = userEditProfile.IsSubscribed;
            profile.ShowDetails      = userEditProfile.ShowDetails;
            profile.IsPlainText      = userEditProfile.IsPlainText;
            profile.HideVanity       = userEditProfile.HideVanity;
            profile.TimeZone         = userEditProfile.TimeZone;
            profile.IsDaylightSaving = userEditProfile.IsDaylightSaving;
            profile.Signature        = _textParsingService.ForumCodeToHtml(userEditProfile.Signature);
            profile.Location         = userEditProfile.Location;
            profile.Dob       = userEditProfile.Dob;
            profile.Web       = userEditProfile.Web;
            profile.Instagram = userEditProfile.Instagram;
            profile.Facebook  = userEditProfile.Facebook;
            profile.Twitter   = userEditProfile.Twitter;
            await _profileRepository.Update(profile);
        }
Example #12
0
 public IActionResult UpdateUserProfile(UserEditProfile model)
 {
     return(Result(() => _userService.UpdateUserProfile(model, CurrentUser.Id)));
 }