コード例 #1
0
 public bool Update(user a)
 {
     try
     {
         using (var ctx = new AuthContext())
         {
             if (ctx.users.Any(el => el.login == a.login)) { return false; }
             ctx.AddTousers(a);
             ctx.ObjectStateManager.ChangeObjectState(a, EntityState.Modified);
             ctx.SaveChanges();
             return true;
         }
     }
     catch
     {
         return false;
     }
 }
コード例 #2
0
 public bool Register(string login , string password)
 {
     try
     {
         using (var ctx = new AuthContext())
         {
             if (ctx.users.Any(el => el.login == login)) return false;
             var u = new user() { login = login, password = password };
             ctx.AddTousers(u);
             ctx.SaveChanges();
         }
         return true;
     }
     catch
     {
         return false;
     }
 }