Beispiel #1
0
        public long AddUser(UserInfoModel user)
        {
            var role = _entity.blog_roles.FirstOrDefault(x => x.roleid == user.RoleId) ?? AddRole(user.RoleId);
            var dbuser = new blog_users
            {
                username = user.UserName,
                userpwd = user.UserPwd,
                usercreatedate = DateTime.Now,
                lastlogindate = DateTime.Now,
                lastactivitydate = DateTime.Now,
                blog_roles = role,
                userstate = 1
            };

            _entity.blog_users.AddObject(dbuser);
            _entity.SaveChanges();

            return dbuser.userid;
        }
Beispiel #2
0
 /// <summary>
 /// 用于向 blog_users EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToblog_users(blog_users blog_users)
 {
     base.AddObject("blog_users", blog_users);
 }
Beispiel #3
0
 /// <summary>
 /// 创建新的 blog_users 对象。
 /// </summary>
 /// <param name="userid">userid 属性的初始值。</param>
 /// <param name="roleid">roleid 属性的初始值。</param>
 /// <param name="username">username 属性的初始值。</param>
 /// <param name="userpwd">userpwd 属性的初始值。</param>
 /// <param name="userstate">userstate 属性的初始值。</param>
 /// <param name="usercreatedate">usercreatedate 属性的初始值。</param>
 /// <param name="lastlogindate">lastlogindate 属性的初始值。</param>
 /// <param name="lastactivitydate">lastactivitydate 属性的初始值。</param>
 public static blog_users Createblog_users(global::System.Int64 userid, global::System.Int32 roleid, global::System.String username, global::System.String userpwd, global::System.Int32 userstate, global::System.DateTime usercreatedate, global::System.DateTime lastlogindate, global::System.DateTime lastactivitydate)
 {
     blog_users blog_users = new blog_users();
     blog_users.userid = userid;
     blog_users.roleid = roleid;
     blog_users.username = username;
     blog_users.userpwd = userpwd;
     blog_users.userstate = userstate;
     blog_users.usercreatedate = usercreatedate;
     blog_users.lastlogindate = lastlogindate;
     blog_users.lastactivitydate = lastactivitydate;
     return blog_users;
 }