Пример #1
0
 public int CheckUserLogin(User usr)
 {
     User user = this.db.Users.FirstOrDefault((User a) => a.Username == usr.Username && a.Password == usr.Password);
     int result;
     if (user != null)
     {
         result = user.UserId;
     }
     else
     {
         result = 0;
     }
     return result;
 }
Пример #2
0
 public int InsertNewUser(User usr)
 {
     this.db.Users.Add(usr);
     int result;
     try
     {
         this.db.SaveChanges();
         result = 1;
     }
     catch
     {
         result = 0;
     }
     return result;
 }