Example #1
0
        public PageModel <IOrder> GetOrdersPage(FilterBase filter)
        {
            var dataFilter = new DataFilterBase
            {
                Skip = filter.Skip,
                Take = filter.Take
            };
            var ordersPageData       = _orderDataManager.GetOrdersPage(dataFilter);
            var ordersPageCollection = ordersPageData.Collection.Select(o => new Models.Order(o, _orderDataManager)).ToList();
            var result = new PageModel <IOrder>(ordersPageData.Count, ordersPageCollection);

            return(result);
        }
        public PageDataModel <OrderDataModel> GetOrdersPage(DataFilterBase filter)
        {
            var count  = _dbContext.Orders.Count();
            var orders = _dbContext.Orders
                         .AsNoTracking()
                         .OrderByDescending(o => o.CreatedDateTime)
                         .Skip(filter.Skip)
                         .Take(filter.Take)
                         .ToList();
            var result = new PageDataModel <OrderDataModel>(count, orders);

            return(result);
        }
        public CategoryItemViewModel Build(Guid categorySystemId, DataFilterBase dataFilter = null)
        {
            if (categorySystemId == Guid.Empty)
            {
                return(null);
            }
            var entity = _categoryService.Get(categorySystemId);

            if (entity == null)
            {
                return(null);
            }
            var pageModel = new CategoryItemViewModel()
            {
                SystemId = categorySystemId
            };

            BuildFields(pageModel, entity, dataFilter?.Culture);
            return(pageModel);
        }
        public VariantInfo Build(Guid variantSystemId, Guid channelSystemId, DataFilterBase dataFilter = null)
        {
            if (variantSystemId == Guid.Empty)
            {
                return(null);
            }
            var entity = _variantService.Get(variantSystemId);

            if (entity == null)
            {
                return(null);
            }
            var pageModel = new VariantInfo()
            {
                SystemId = variantSystemId
            };
            var currency = _currencyService.Get(id: ((ProductDataFilter)dataFilter)?.Currency) ?? _currencyService.GetBaseCurrency();

            BuildFields(pageModel, entity, dataFilter?.Culture);
            BuildPrices(pageModel, entity, currency, channelSystemId);
            return(pageModel);
        }
        public override CategoryPageViewModel Build(Guid categorySystemId, DataFilterBase dataFilter = null)
        {
            if (categorySystemId == Guid.Empty)
            {
                return(null);
            }
            var entity = _categoryService.Get(categorySystemId);

            if (entity == null)
            {
                return(null);
            }
            var pageModel = new CategoryPageViewModel()
            {
                SystemId = categorySystemId
            };

            BuildFields(pageModel, entity, dataFilter?.Culture);
            BuildProducts(pageModel);
            BuildBlocks(pageModel, entity);
            BuildAdditionProperties(pageModel, entity);
            return(pageModel);
        }
Example #6
0
 public abstract T Build(Guid systemId, DataFilterBase dataFilter = null);