/**
  * @return View
  * @Route("")
  */
 public function categories()
 {
     $categories = $this->eshopData->getCategoriesRepository()->getCategories();
     $products = $this->eshopData->getProductsRepository()->getAllProducts();
     $viewModel = new CategoriesViewModel();
     $viewModel->categories = $categories;
     $viewModel->products = $products;
     return new View("category/categories", $viewModel);
 }
 /**
  * @POST
  * @Roles(Administrator, Editor)
  * @Route("{id:num}")
  */
 public function changeCategory($id, ChangeProductCategoryBindingModel $model)
 {
     $result = $this->eshopData->getProductsRepository()->changeCategory($id, $model->getCategoryId());
     RouteService::redirect('products', '', [$id], true);
 }
 /**
  * @Authorize
  * @Route("cart/product/{productId:num}/decrease")
  */
 public function decreaseProductQuantityInCart($productId)
 {
     $cartId = $this->eshopData->getUsersRepository()->getUserCartId(Session::get('userId'))['id'];
     $result = $this->eshopData->getProductsRepository()->decreaseQuantityInCart($productId, $cartId);
     RouteService::redirect('account', 'cart');
 }