예제 #1
0
 private void Follow(object sender, RoutedEventArgs e)
 {
     user = repository.GetUserByNick(PersonNickName2);
     if (!services.CheckAlreadyFollow(user.Nick, PersonNickName))
     {
         services.Follow(user.Nick, PersonNickName);
         services.Follow(PersonNickName, user.Nick);
         btnFollow.Background = Brushes.Green;
     }
 }
예제 #2
0
        public SearchWindow(string nick, string nick2)
        {
            InitializeComponent();
            PersonNickName  = nick;
            PersonNickName2 = nick2;
            //
            repository     = new UR();
            services       = new US();
            postServices   = new PS();
            postRepository = new PR();
            //
            user                = new User();
            user                = repository.GetUserByNick(PersonNickName);
            UserName.Content    = user.person.Name;
            UserSurname.Content = user.person.Surname;
            UserMail.Content    = user.person.Mail;
            //
            currentPost = new Posts();
            posts       = new List <Posts>();
            posts       = postRepository.GetPostsByUserId(repository.GetUserId(PersonNickName));
            if (posts != null && posts.Count > 0)
            {
                currentPost = posts[indexOfPost];

                DG1.ItemsSource = currentPost.comment;
                isAnyPosts      = true;
            }
            else
            {
                Main.Content = "No posts yet";
            }
            //
            if (tempLike)
            {
                btnLike.Background = Brushes.Green;
                tempLike           = true;
            }

            user = repository.GetUserByNick(PersonNickName2);
            if (services.CheckAlreadyFollow(user.Nick, PersonNickName))
            {
                btnFollow.Background = Brushes.Green;
            }
        }