Esempio n. 1
0
 public static UserInfo Login(string name, string pwd)
 {
     using (ChatDbContext db = new ChatDbContext())
     {
         return db.UserInfos.FirstOrDefault(u => u.Name == name && u.Password == pwd);
     }
 }
Esempio n. 2
0
 public static UserInfo GetByID(int id)
 {
     using (ChatDbContext db = new ChatDbContext())
     {
         var ur = db.UserInfos.FirstOrDefault(u => u.Id == id);
         return ur;
     }
 }
Esempio n. 3
0
 public static UserInfo Regester(UserInfo usr)
 {
     using (ChatDbContext db = new ChatDbContext())
     {
         var ur = db.UserInfos.Add(usr);
         db.SaveChanges();
         return ur;
     }
 }
Esempio n. 4
0
        public static bool Exist(string usrName)
        {
            using (ChatDbContext db = new ChatDbContext())
            {
                var ur = db.UserInfos.Any(u => u.Name == usrName);

                return ur;
            }
        }