示例#1
0
        public IVmOpenApiGuidPageVersionBase GetServiceCollections(DateTime?date, int pageNumber, int pageSize, bool archived)
        {
            var vm = new V3VmOpenApiGuidPage(pageNumber, pageSize);

            if (pageNumber <= 0)
            {
                return(vm);
            }

            List <ServiceCollectionVersioned> collections = null;

            contextManager.ExecuteReader(unitOfWork =>
            {
                if (archived)
                {
                    collections = GetArchivedEntities <ServiceCollectionVersioned, ServiceCollection, ServiceCollectionLanguageAvailability>(vm, date, unitOfWork, q => q.Include(i => i.ServiceCollectionNames));
                }
                else
                {
                    collections = GetPublishedEntities <ServiceCollectionVersioned, ServiceCollection, ServiceCollectionLanguageAvailability>(vm, date, unitOfWork, q => q.Include(i => i.ServiceCollectionNames));
                }
            });

            if (collections?.Count > 0)
            {
                vm.ItemList = TranslationManagerToVm.TranslateAll <ServiceCollectionVersioned, VmOpenApiItem>(collections).ToList();
            }

            return(vm);
        }
        /// <summary>
        /// Converts model into version 6.
        /// </summary>
        /// <returns></returns>
        public VmOpenApiGuidPageVersionBase ConvertToVersion6()
        {
            var vm = new V3VmOpenApiGuidPage(this.PageNumber, this.PageSize);

            vm.PageCount = this.PageCount;
            if (this.ItemList?.Count > 0)
            {
                vm.ItemList = new List <VmOpenApiItem>();
            }
            this.ItemList.ForEach(i => vm.ItemList.Add(i.ConvertToVersion6()));
            return(vm);
        }