private void Like(object sender, RoutedEventArgs e)
 {
     if (_posts.Count > 0)
     {
         if (_tempLike == false)
         {
             btnLike.BorderBrush = Brushes.MediumPurple;
             _tempLike           = true;
             _postDAL.AddLike(_userBLL.LoginRead(), _current_post.Id);
         }
         else
         {
             btnLike.BorderBrush = Brushes.Transparent;
             _tempLike           = false;
             _postDAL.DismissLike(_userBLL.LoginRead(), _current_post.Id);
         }
         btnLikers.Content   = "View likers: " + _postBLL.GetNumOfLikes(_current_post.Id).ToString();
         btnComments.Content = "View comments: " + _postBLL.GetWhoCommented(_current_post.Id).Count;
     }
     else
     {
         btnLike.BorderBrush = Brushes.Transparent;
         _tempLike           = false;
     }
 }
Exemple #2
0
 public void AddLike(string userLogin, ObjectId postId)
 {
     try
     {
         postDAL.AddLike(userLogin, postId);
     }
     catch { }
 }
 private void Like(object sender, RoutedEventArgs e)
 {
     if (_posts.Count > 0)
     {
         if (_tempLike == false)
         {
             btnLike.BorderBrush = Brushes.White;
             _tempLike           = true;
             _postDAL.AddLike(_userBLL.LoginRead(), _current_post.Id);
         }
         else
         {
             btnLike.BorderBrush = Brushes.Transparent;
             _tempLike           = false;
             _postDAL.DismissLike(_userBLL.LoginRead(), _current_post.Id);
         }
         btnLike.Content = "Likes: " + _postBLL.GetNumOfLikes(_current_post.Id).ToString();
     }
     else
     {
         btnLike.BorderBrush = Brushes.Transparent;
         _tempLike           = false;
     }
 }