示例#1
0
        private Models.FollowItemType GetFollowItemType(Interfaces.IFollowable item)
        {
            if (item is Interfaces.ISearchWithtag)
            {
                return(Models.FollowItemType.Tag);
            }
            if (item is Interfaces.IUser)
            {
                return(Models.FollowItemType.User);
            }
            if (item is Interfaces.IMylist)
            {
                return(Models.FollowItemType.Mylist);
            }
            if (item is Interfaces.ICommunity)
            {
                return(Models.FollowItemType.Community);
            }
            if (item is Interfaces.IChannel)
            {
                return(Models.FollowItemType.Channel);
            }

            throw new NotSupportedException();
        }
示例#2
0
        public bool IsFollowItem(Interfaces.IFollowable followItem)
        {
            if (followItem == null)
            {
                return(false);
            }

            return(IsFollowItem(ToFollowItemType(followItem), followItem.Id));
        }
示例#3
0
        public bool CanMoreAddFollow(Interfaces.IFollowable followItem)
        {
            if (followItem == null)
            {
                return(false);
            }

            return(CanMoreAddFollow(ToFollowItemType(followItem)));
        }
示例#4
0
        static FollowItemType ToFollowItemType(Interfaces.IFollowable followItem)
        {
            switch (followItem)
            {
            case Interfaces.IChannel _: return(FollowItemType.Channel);

            case Interfaces.ICommunity _: return(FollowItemType.Community);

            case Interfaces.IUser _: return(FollowItemType.User);

            case Interfaces.IMylist _: return(FollowItemType.Mylist);

            case Interfaces.ITag _: return(FollowItemType.Tag);

            case Interfaces.ISearchWithtag _: return(FollowItemType.Tag);

            default: throw new NotSupportedException();
            }
        }
示例#5
0
 public async Task <ContentManageResult> RemoveFollow(Interfaces.IFollowable followItem)
 {
     return(await RemoveFollow(ToFollowItemType(followItem), followItem.Id));
 }
示例#6
0
 public async Task <ContentManageResult> AddFollow(Interfaces.IFollowable followItem, object token = null)
 {
     return(await AddFollow(ToFollowItemType(followItem), followItem.Id, followItem.Label, token));
 }