Time for action – Adding a user
Now, let's create the function to add a user. It will take the login and the password as parameters and will return the created object as follows:
public static function createUser(login : String, password : String) : hxBlog.User { var u = new hxBlog.User(); u.username = login; u.setPassword(password); u.insert(); return u; }
Get haXe 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.