public async Task favoriteService_should_remove_favorite_to_db()
        {
            await dbProvider.InitializeDb();

            var p = new Navigation();

            p.CurrentParameter = new CoffeeShop {
                Id = "abcId"
            };
            _viewModel = new CoffeeViewModel(_favoriteSvc, p);
            _viewModel.Initialize();

            await _favoriteSvc.AddToFavorite("abcId");

            Assert.IsTrue((await _favoriteSvc.GetFavorites()).Count(f => f == "abcId") == 1, "Favorite is not in the db");

            await _viewModel.RemoveFromFavorite();

            Assert.IsTrue((await _favoriteSvc.GetFavorites()).Count(f => f == "abcId") == 0, "Favorite is still is db");
        }
        public IActionResult AddToFav(int productId)
        {
            if (!_currentUser.IsAuthenticated)
            {
                return(BadRequest(new ClientErrorData {
                    Title = "Unauthenticated"
                }));
            }

            var prod = _productService.GetProductById(productId);

            if (prod == null || !_favoriteService.AddToFavorite(new FavoriteProduct {
                UserId = _currentUser.Id, ProductId = prod.Id
            }))
            {
                return(BadRequest(new ClientErrorData {
                    Title = "Error"
                }));
            }

            return(RedirectToAction("Index", "Favorite"));
        }