Esempio n. 1
0
        public IActionResult StValentin()
        {
            var stValent = GenreList.GenreNames[2];
            var genreId  = _genreService.All().Where(x => x.Name.ToLower().Contains(stValent.ToLower())).Select(x => x.Id).FirstOrDefault();

            var allProductsN = productServices.GetAllProducts()
                               .Where(type => type.ProductTypes == ProductTypes.Film && type.GenreId == genreId)
                               .Select(x => new ProductIndexHomeViewModel
            {
                Id          = x.Id,
                Description = x.Description,
                Price       = x.Price,
                Picture     = x.Picture,
                Publishing  = x.Publishing,
                Title       = x.Title,
                UsersCount  = _userServices.GetAllUsers().Count
            }).ToList();

            AllProductIndex allP = new AllProductIndex()
            {
                Products = allProductsN
            };

            return(View(allP));
        }
Esempio n. 2
0
        public IActionResult Index([FromQuery] string criteria = null)
        {
            var allProductsN = _productServices.GetAllProducts(criteria).Select(x => new ProductIndexHomeViewModel
            {
                Id          = x.Id,
                Description = x.Description,
                Price       = x.Price,
                Picture     = x.Picture,
                Publishing  = x.Publishing,
                Title       = x.Title,
                UsersCount  = _userServices.GetAllUsers().Count
            }).ToList();

            this.ViewData["criteria"] = criteria;

            AllProductIndex allP = new AllProductIndex()
            {
                Products = allProductsN
            };

            return(View(allP));
        }