Shepet
@Shepet

Как реализовать авторизацию в приложении Wpf (БД MySQL)?

Здравствуй! Я пишу приложение на WPF, я новичок и мало чего понимаю. Мне нужна помощь в решении ошибки: ()
.Where(r => r.Login == __TBlogin_Text_0 && r.Pass.ToString() == __TBpass_Text_1)' could not be translated. Additional information: Translation of method 'object.ToString' failed. If this method can be mapped to your custom function, see https://go.microsoft.com/fwlink/?linkid=2132413 for more information. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.'
> искал-искал так и не нашел решение проблемы, точнее не понял как это исправить можно. Если вы можете мне объяснить как это можно пофиксить, или есть другой способ реализовать это, я буду очень благодарен!

private void BtExit_Click(object sender, RoutedEventArgs e)
        {

            if (TBlogin.Text == null || TBpass.Text == null)
            {
                MessageBox.Show("Заполните все поля!");
            }
            else
            {
                Role role = ManiModel.init().Roles.FirstOrDefault(p => p.Login == TBlogin.Text &&
                (p.Pass.ToString() == TBpass.Text));
                 
                if (role != null)
                {
                    if (role.role == "Admin")
                    {
                        MessageBox.Show("Добро пожаловать в систему!");
                    }
                    else
                    {
                        WinMenu wend = new WinMenu();
                        wend.Show();
                        Hide();
                    }
                }
            }

        }
  • Вопрос задан
  • 198 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы