예제 #1
0
        public static int GetID(string username)
        {
            int id;

            using (KnygosEntities2 contex = new KnygosEntities2())
            {
                Vartotojai vartotojass = contex.Vartotojais.FirstOrDefault(r => r.Userame == username);
                id = (int)vartotojass.Id;
            }
            return(id);
        }
예제 #2
0
 public void FillData(String username, String password, int vartotojas)
 {
     using (KnygosEntities2 contex = new KnygosEntities2())
     {
         Vartotojai vartotojass = new Vartotojai()
         {
             Userame    = username,
             Password   = password,
             Vartotojas = vartotojas,
         };
         contex.Vartotojais.Add(vartotojass);
         contex.SaveChanges();
     }
 }
예제 #3
0
        public bool CheckData(String username, String password, int vartotojas)
        {
            bool exists = false;

            using (KnygosEntities2 contex = new KnygosEntities2())
            {
                Vartotojai vartotojass = contex.Vartotojais.FirstOrDefault(r => r.Userame == username &&
                                                                           r.Password == password && r.Vartotojas == vartotojas);

                if (vartotojass != null)
                {
                    exists = true;
                }
            }
            return(exists);
        }