Beispiel #1
0
        public static List <Adminler> getCredentials(string username, string password)
        {
            WebAutomationEntities db = new WebAutomationEntities();

            using (db)
            {
                var sorgu = from p in db.Adminler
                            where p.Email == username && p.Sifre == password
                            select p;

                List <Adminler> infos = sorgu.ToList();
                return(infos);
            }
        }
        public bool UserLogin(string email, string password)
        {
            WebAutomationEntities db = new WebAutomationEntities();

            using (db)
            {
                var sorgu = (from x in db.Adminler
                             where x.Email == email && x.Sifre == password
                             select x).FirstOrDefault();
                if (sorgu != null)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Beispiel #3
0
        public static int getSessionRole(string username, string password)
        {
            WebAutomationEntities db = new WebAutomationEntities();

            using (db)
            {
                try
                {
                    var query = (from role in db.Adminler
                                 where role.Email == username && role.Sifre == password
                                 select role.Yetki).FirstOrDefault();
                    return(query ?? -1);
                }

                catch
                {
                    return(00404);
                }
            }
        }
        public void UserRegister(string name, string surname, string email, string password)
        {
            WebAutomationEntities db = new WebAutomationEntities();

            Adminler a = new Adminler();

            try
            {
                a.Ad    = name;
                a.Soyad = surname;
                a.Email = email;
                a.Sifre = password;
                a.Yetki = 1;
                db.Adminler.Add(a);
                db.SaveChanges();
            }
            catch (Exception e)
            {
                throw e;
            }
        }