示例#1
0
        public IActionResult Dvd()
        {
            var headphones = GenreList.GenreNames[11];
            var genreId    = _genreService.All().Where(x => x.Name.ToLower().Contains(headphones.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));
        }
示例#2
0
        public IActionResult Create()
        {
            var genres = _genreService.All().Select(x => new GenreViewModels()
            {
                Id   = x.Id,
                Name = x.Name
            }).ToList();

            CreateProductBindingModel createProduct = new CreateProductBindingModel()
            {
                GenresViewModel = genres
            };

            return(View(createProduct));
        }
示例#3
0
        public async Task <ActionResult <PagedResponse <IEnumerable <Genre> > > > Get([FromQuery] GenreSearchRequest request)
        {
            var genres = await _genreService.All(request);

            return(Ok(genres));
        }
 public IEnumerable <Genre> All(bool @readonly = false)
 {
     return(_service.All(@readonly));
 }
        public async Task <IActionResult> Get()
        {
            var result = await _genreService.All();

            return(new JsonResult(result));
        }