public static bool CreatUser(User user) { using (PetaPoco.Database db = new PetaPoco.Database("sqlconnection")) { user.Password = XBBS.Core.Utils.MD5(user.Password); return db.Insert(user) != null; } }
public static User GetUser(int uid) { User user = null; using (PetaPoco.Database db = new PetaPoco.Database("sqlconnection")) { user = db.SingleOrDefault<Models.User>("WHERE uid=@0 ", uid); } if (user == null) user = new User(); return user; }