Exemple #1
0
        public async Task <IActionResult> Profile(string username)
        {
            var profile = new ProfileViewer();

            ViewData["Title"] = "View Profile";

            var user = await repositoryFactory.User.GetByUsernameAsync(username);

            if (user is null)
            {
                return(NotFound("Access denied!"));
            }

            var posts = await repositoryFactory.Post.GetPostByUserIdAsync(user.Id);

            var postCount = await repositoryFactory.Post.CountByUserId(user.Id);

            var comments = await repositoryFactory.Comment.GetCommentsByUsernameAsync(username);

            var commentCount = await repositoryFactory.Comment.CountByUsernameAsync(username);

            profile.UserProfile  = commonFactory.Mapper.Map <UserProfileViewModel>(user);
            profile.Posts        = posts?.Select(post => commonFactory.Mapper.Map <RecentPostViewModel>(post)).ToList();
            profile.Comments     = comments?.Select(comment => commonFactory.Mapper.Map <CommentItem>(comment)).ToList();
            profile.TotalPost    = postCount;
            profile.TotalComment = commentCount;

            return(View("Profile", profile));
        }
        private void ProfileViewerButton_Click(object sender, RoutedEventArgs e)
        {
            this.splitView.IsPaneOpen = false;

            var profileViewer = new ProfileViewer();
            profileViewer.Show();
        }
Exemple #3
0
        public async Task ViewProfileAsync(SocketUser user = null)
        {
            user ??= Context.User;
            Context.TryGetUser(user.Id, out ArcadeUser account);

            if (await CatchEmptyAccountAsync(account))
            {
                return;
            }

            await Context.Channel.SendMessageAsync(ProfileViewer.View(account, Context));
        }
 public ProfileViewerComponent(ProfileViewer p1)
 {
     InitializeComponent();
     lblFullName.Text   = p1.JobSeeker.Name + " " + p1.JobSeeker.LastName;
     lblProfession.Text = p1.JobSeeker.City;
 }
 //------------------------------------------------------------------
 //Part 2
 public static void ViewProfile(ProfileViewer p1)
 {
     DbContext.ProfileViewers.Add(p1);
 }