public static async Task <IList <WebChannelGroup> > ProcessAsync(IOwinContext context, int start, int end, WebSortField?sort, WebSortOrder?order)
        {
            if (!ServiceRegistration.IsRegistered <ITvProvider>())
            {
                throw new BadRequestException("GetGroupsByRange: ITvProvider not found");
            }

            var groups = await TVAccess.GetGroupsAsync(context);

            List <WebChannelGroup> output = new List <WebChannelGroup>();

            foreach (var group in groups)
            {
                output.Add(ChannelGroup(group));
            }

            // sort
            if (sort != null && order != null)
            {
                output = output.SortGroupList(sort, order).ToList();
            }

            // get range
            output = output.TakeRange(start, end).ToList();

            return(output);
        }
示例#2
0
        public static async Task <WebIntResult> ProcessAsync(IOwinContext context)
        {
            if (!ServiceRegistration.IsRegistered <ITvProvider>())
            {
                throw new BadRequestException("GetChannelsBasic: ITvProvider not found");
            }

            var channelGroups = await TVAccess.GetGroupsAsync(context);

            return(new WebIntResult {
                Result = channelGroups.Count
            });
        }