Exemple #1
0
        public ActionResult OutOfDate(string culture, int page = 1, int pageSize = 50)
        {
            var items    = _translationStore.FindOutOfDate(CultureInfo.GetCultureInfo(culture), typeof(Brand), page - 1, pageSize);
            var brandIds = items.Select(t => (int)t.EntityKey.Value).ToArray();
            var brands   = _brandService.Query().Where(b => brandIds.Contains(b.Id)).ToList();

            var models = items.Transform(t =>
            {
                var brandId = (int)t.EntityKey.Value;
                var brand   = brands.Find(b => b.Id == brandId);
                return(new BrandGridItemModel(brand)
                {
                    IsOutOfDate = t.IsOutOfDate,
                    IsTranslated = true,
                    TranslatedName = t.GetTranslatedText("Name")
                });
            });

            return(View(models.ToPagedList()));
        }
        public ActionResult OutOfDate(string culture, int page = 1, int pageSize = 50)
        {
            var items        = _translationStore.FindOutOfDate(CultureInfo.GetCultureInfo(culture), typeof(ProductType), page - 1, pageSize);
            var ids          = items.Select(it => (int)it.EntityKey.Value).ToArray();
            var productTypes = _repository.Query().Where(it => ids.Contains(it.Id)).ToList();

            var models = items.Transform(it =>
            {
                var typeId      = (int)it.EntityKey.Value;
                var productType = productTypes.Find(t => t.Id == typeId);
                return(new ProductTypeGridItemModel
                {
                    Id = typeId,
                    IsOutOfDate = true,
                    IsTranslated = true,
                    Name = productType.Name
                });
            });

            return(View(models.ToPagedList()));
        }
Exemple #3
0
        public ActionResult OutOfDate(string culture, int page = 1, int pageSize = 50)
        {
            var items      = _translationStore.FindOutOfDate(CultureInfo.GetCultureInfo(culture), typeof(Product), page - 1, pageSize);
            var productIds = items.Select(p => (int)p.EntityKey.Value).ToArray();
            var products   = CurrentInstance.Database.Repository <Product>().Query().Where(p => productIds.Contains(p.Id)).ToList();

            var models = items.Transform(t =>
            {
                var productId = (int)t.EntityKey.Value;
                var product   = products.Find(p => p.Id == productId);
                return(new ProductGridItemModel
                {
                    Id = product.Id,
                    IsOutOfDate = true,
                    IsTranslated = true,
                    Name = product.Name,
                    TranslatedName = t.GetTranslatedText("Name")
                });
            });

            return(View(models.ToPagedList()));
        }