Esempio n. 1
0
 public static void ChangePassword(string login, string password)
 {
     using (var context = new MVCDBEntities())
     {
         var user = context.Users.First(u => u.Login == login);
         user.Password = password;
         context.SaveChanges();
     }
 }
Esempio n. 2
0
 public static void Add(string login, string password)
 {
     using (var context = new MVCDBEntities())
     {
         var user = new User {Login = login, Password = password};
         context.Users.Add(user);
         context.SaveChanges();
     }
 }
Esempio n. 3
0
 public static string IsValid(string login)
 {
     using (var context = new MVCDBEntities())
         return context.Users.Where(u => u.Login == login).Select(u => u.Password).First();
 }
Esempio n. 4
0
 public static bool IsUnique(string login)
 {
     using (var context = new MVCDBEntities())
         return context.Users.Count(u => u.Login == login) == 0;
 }