示例#1
0
        /// <summary>
        /// 分享内部资源
        /// </summary>
        /// <param name="tenantId"></param>
        /// <param name="userId"></param>
        /// <param name="objectId"></param>
        /// <param name="objectType">
        /// <para>0:课程</para>
        /// <para>1:知识</para>
        /// <para>2:计划</para>
        /// <para>3:讲师</para>
        /// <para>10:外部资源</para>
        /// </param>
        /// <param name="sourceId">来源ID</param>
        /// <param name="shareObject"></param>
        /// <param name="recommend"></param>
        /// <returns></returns>
        public static int AddStationiShare(int tenantId, int userId, int objectId, int objectType, int sourceId, List <ShareTarget> shareObject, string recommend)
        {
            var model = new IntShared
            {
                TenantId     = tenantId,
                ObjectId     = objectId,
                ObjectType   = objectType,
                SourceId     = sourceId,
                ShareTime    = DateTime.Now,
                UserId       = userId,
                IsDelete     = 0,
                Recommend    = recommend,
                ResourceName = "",
                ResourceUrl  = ""
            };

            model.ShareId = _dataAccess.AddEntity(model);

            if (shareObject.Count > 0)
            {
                for (int i = 0; i < shareObject.Count; i++)
                {
                    shareObject[i].ShareId = model.ShareId;
                }
                _dataAccess.AddEntities(shareObject);
            }

            return(model.ShareId);
        }
示例#2
0
        /// <summary>
        /// 分享外部资源
        /// </summary>
        /// <param name="tenantId"></param>
        /// <param name="userId"></param>
        /// <param name="resourceName">名称</param>
        /// <param name="recommend">心得</param>
        /// <param name="resourceUrl">链接</param>
        /// <returns></returns>
        public static int AddExternalShare(int tenantId, int userId, string resourceName, string recommend, string resourceUrl)
        {
            var model = new IntShared
            {
                TenantId     = tenantId,
                ShareTime    = DateTime.Now,
                UserId       = userId,
                IsDelete     = 0,
                Recommend    = recommend,
                ResourceName = resourceName,
                ResourceUrl  = resourceUrl,
                ObjectId     = 0,
                ObjectType   = 10,
                SourceId     = 0
            };

            return(_dataAccess.AddEntity(model));
        }