Ejemplo n.º 1
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;
     }
 }