private void btnDeactivate_Click(object sender, RoutedEventArgs e) { UserDTO userDto = ((FrameworkElement)sender).DataContext as UserDTO; if (MessageBox.Show("Are you sure you want to deactivate " + userDto.FirstName + " " + userDto.Email + "?", "Are you sure?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) { var op = Userbll.Deactivate(userDto.UserID); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("User is successfully deactivated from table"); showData(); } } ; }