123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- 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 ModuleExam
- {
- /// <summary>
- /// Логика взаимодействия для Auth.xaml
- /// </summary>
- public partial class Auth : Page
- {
- ExamEntities DB = new ExamEntities();
- public Auth()
- {
- InitializeComponent();
- }
- private void MakeAuth(object sender, RoutedEventArgs e)
- {
- int id = CheckOnExisting(Email.Text, Pass.Password);
- if (id !=-1)
- {
- MainFrame.MFrame.Navigate(new ActivityPage(id));
- }
- else
- {
- MessageBox.Show("Вас не в системе");
- }
- }
- public int CheckOnExisting(string Mail, string Password)
- {
- users user = new users();
- user = DB.users.Where(x => x.email == Mail && x.password == Password).FirstOrDefault();
- if(user != null)
- {
- return user.id;
- }
- else { return -1; }
- }
- }
- }
|