Esempio n. 1
0
        static void Main(string[] args)
        {
            user u = new user();
            u.userName = "******";
            u.password = "******";
            User.saveUser(u);
            Console.WriteLine( User.getIdentity("hui", "123"));

            Console.ReadKey();
        }
Esempio n. 2
0
 //用户注册 -- UserRegist
 //todo: 同名的username可以添加
 public static int saveUser(user u)
 {
     using (var ctx = new hackthonEntities())
     {
         if (u.credits == null) u.credits = 0; //虽然db中默认值为0,但是添加新行还是为空;
         ctx.AddTousers(u);
         ctx.SaveChanges();
         return u.userID;
     }
 }
 /// <summary>
 /// Create a new user object.
 /// </summary>
 /// <param name="userID">Initial value of the userID property.</param>
 public static user Createuser(global::System.Int32 userID)
 {
     user user = new user();
     user.userID = userID;
     return user;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTousers(user user)
 {
     base.AddObject("users", user);
 }