Пример #1
0
        private void findBySurnameButton_Click(object sender, EventArgs e)
        {
            var     readerRepository = new ReaderRepository();
            TextBox thisTextBox      = sender as TextBox;

            if (string.IsNullOrEmpty(thisTextBox.Text))
            {
                SetDataGridView();
                return;
            }
            List <Reader> readers = readerRepository.FindBySurname(thisTextBox.Text);

            if (readers == null)
            {
                readerDataGridView.DataSource = "No readers found";
                return;
            }

            readerDataGridView.DataSource = readers.OrderBy(b => b.Id)
                                            .Select(b => new
            {
                b.Id,
                b.Name,
                b.Surname,
                b.Patronymic,
                b.TelephoneNumber,
                b.Email
            }).ToList();;
        }