Beispiel #1
0
        private void getUser(string userName)
        {
            var user        = _userService.GetUserByUsername(userName);
            var currentUser = _authenticationService.GetAuthenticatedUser();

            if (currentUser == null)
            {
                Response.Redirect($"/login?ReturnUrl={Request.RawUrl}");
            }

            if (currentUser.Id != user.ID)
            {
                btnEdit.Style["display"] = "none";
            }

            var userDetails = _userService.GetUserDetails(user.ID);

            profilePicture.ImageUrl = userDetails.Avatar;
            username.Text           = userDetails.Username;
            fullname.Text           = userDetails.Fullname;
            gender.Text             = userDetails.Gender.ToString();
            age.Text      = TimePeriod.GetAge(userDetails.Birthdate).ToString();
            bio.Text      = userDetails.Bio;
            topics.Text   = userDetails.NumTopics.ToString();
            comments.Text = userDetails.NumComments.ToString();
        }