Exemple #1
0
        /// <summary>
        /// 新增角色。
        /// </summary>
        /// <param name="dto">待新增角色的信息。</param>
        /// <returns>新角色的Id。</returns>
        public static string InsertRole(RoleDTO dto)
        {
            Role r = new Role();

            r.Id      = IdGen.GetNextId(typeof(Role));
            r.Name    = dto.Name;
            r.Remark  = dto.Remark;
            r.OrderId = dto.OrderId;

            RoleType rt = Db.Session.Load(typeof(RoleType), dto.RoleTypeId) as RoleType;

            rt.AddRole(r);

            Db.TransInsert(r);
            return(r.Id);
        }