public User AuthenticateUser(string email, string password)
        {
            using (var context = new MedicalDBEntities())
            {
                var query = context.Users
                            .Where(s => s.email == email && s.password == password)
                            .FirstOrDefault <User>();

                User user = query;
                if (user == null)
                {
                    throw new UnauthorizedAccessException("Contul dumneavoastra nu a fost gasit, va rugam sa reincercati.");
                }

                else
                {
                    return(user);
                }
            }
        }
Exemple #2
0
 public MainWindow()
 {
     InitializeComponent();
     /*creez contextul in care lucrez cu EF*/
     var context = new MedicalDBEntities();
 }