private void ExecuteConfirmCommand(object param) { var users = de.GetUserList(); for (int i = 0; i < users.Count; i++) { if (users[i].phone_number == "Admin" && users[i].password == Password) { VisibilityLol = System.Windows.Visibility.Hidden; de.AddBook(title, author, year, genre); MyMsgBox msg = new MyMsgBox("Книга добавлена!"); msg.Show(); return; } if (i == users.Count() - 1) { MyMsgBox msg1 = new MyMsgBox("Пароль введен неверно!"); msg1.Show(); break; } } }