Example #1
0
        /// <summary>
        /// 创建用户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static int InsertAll(Sys_User model)
        {
            var userId = 0;

            using (var tran = Db.GetTransaction())
            {
                //新增用户基本信息。
                userId = UserAccess.Insert(model);
                if (userId > 0)
                {
                    //新增用户角色信息。
                    UserRoleRelationAccess.SetRole(userId, model.RoleId, model.SUCreateUser);
                    //新增用户登陆信息。
                    Sys_Userlogon userLogOnEntity = new Sys_Userlogon()
                    {
                        SULUserId    = userId,
                        SULLoginName = model.SUAccount,
                        SULPassword  = model.Password,
                    };
                    var userLoginId = UserLogOnAccess.Insert(userLogOnEntity);
                }
                tran.Complete();
            }
            return(userId);
        }
Example #2
0
 public ActionResult Form(Sys_Userlogon model)
 {
     if (model.Id == 0)
     {
         var primaryKey = UserLogOnService.Insert(model);
         return(primaryKey > 0 ? Success() : Error());
     }
     else
     {
         var row = UserLogOnService.UpdateInfo(model);
         return(row > 0 ? Success() : Error());
     }
 }