コード例 #1
0
ファイル: Index.cshtml.cs プロジェクト: ertanhasani/ecommerce
        public void OnGet()
        {
            var products = _productRepository.GetProducts().Take(12);

            foreach (var item in products)
            {
                Products.Add(new ProductListViewModel()
                {
                    Id        = item.Id,
                    Url       = "/Producti/" + item.Id,
                    Title     = item.Name,
                    IsOnSale  = (bool)item.IsOnSale,
                    Price     = (decimal)_productRepository.GetCurrentPrice(item.Id).Price1,
                    SalePrice = _productRepository.GetSalePrice(item.Id) != null ? (decimal)_productRepository.GetSalePrice(item.Id).Price1 : 0.00M,
                    ImagePath = Url.Content(_uploadRepository.GetProductThumbnail(item.Id).Path)
                });
            }

            var carousels = _uploadRepository.GetCarousels();

            foreach (var item in carousels)
            {
                Carousels.Add(new CarouselViewModel()
                {
                    Id   = item.Id,
                    Name = item.FileName,
                    Path = Url.Content(item.Path)
                });
            }
        }
コード例 #2
0
        public void OnGet()
        {
            var carousels = _uploadRepository.GetCarousels();

            foreach (var item in carousels)
            {
                Carousels.Add(new CarouselViewModel()
                {
                    Id   = item.Id,
                    Name = item.FileName,
                    Path = Url.Content(item.Path)
                });
            }
        }