using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Penis
{
    /// <summary>
    /// Логика взаимодействия для Tabl.xaml
    /// </summary>
    public partial class Tabl : Page
    {
        public Tabl()
        {
            InitializeComponent();
            Entities entities = new Entities();
            
            Reks.ItemsSource = entities.Client.ToList();
            
        }
        public void Nazad1(object sender, RoutedEventArgs e)
        {
            MainFrame.Name1.Navigate(new PageAdmin());
        }
        public void AZ(object sender, RoutedEventArgs e)
        {
            Entities entities = new Entities();
            Reks.ItemsSource = entities.Client.OrderBy(x => x.Surname).ToList();
            

        }
        public void ZA(object sender, RoutedEventArgs e)
        {
            Entities entities = new Entities();
            Reks.ItemsSource = entities.Client.OrderByDescending (x => x.Surname).ToList();
        }
        public void Men(object sender, RoutedEventArgs e)
        {
            Entities entities = new Entities();
            Reks.ItemsSource = entities.Client.Where(x => x.id_Gender==1).ToList();
        }
        public void Gerl(object sender, RoutedEventArgs e)
        {
            Entities entities = new Entities();
            Reks.ItemsSource = entities.Client.Where(x => x.id_Gender == 2).ToList();
        }
        public void Poisk(object sender, RoutedEventArgs e)
        {
            Entities entities = new Entities();
            string S = Poiskk.Text;
            Reks.ItemsSource= entities.Client.Where(x=>x.Surname.StartsWith(S) || x.Name.StartsWith(S) ).ToList();
        }

    }
}
