Beispiel #1
0
        public ActionResult EditUser(int id)
        {
            var user = _userService.GetUser(id);

            if (user == null)
            {
                throw new Exception(String.Format("UserID {0} not found.", id));
            }
            var profile = _profileService.GetProfileForEdit(user);
            var model   = new UserEditWithFiles(user, profile);

            return(View(model));
        }
Beispiel #2
0
        public ActionResult EditUser(int id, UserEditWithFiles userEdit)
        {
            var user       = _userRetrievalShim.GetUser(HttpContext);
            var targetUser = _userService.GetUser(id);

            if (targetUser == null)
            {
                throw new Exception(String.Format("UserID {0} not found.", id));
            }
            var avatarFile = userEdit.AvatarFile?.OpenReadStream().ToBytes();
            var photoFile  = userEdit.PhotoFile?.OpenReadStream().ToBytes();

            _userService.EditUser(targetUser, userEdit, userEdit.DeleteAvatar, userEdit.DeleteImage, avatarFile, photoFile, HttpContext.Connection.RemoteIpAddress.ToString(), user);
            return(RedirectToAction("EditUserSearch"));
        }