public void ShouldRetrieveFavoriteProducts()
        {
            crudOnFavorites.AddProductToFavorites(username, productId).Wait();
            var pocos = crudOnFavorites.GetUsersFavoriteProducts(username).Result;

            Assert.IsNotNull(pocos);
            crudOnFavorites.DeleteProductFromFavorites(username, productId);
        }
Beispiel #2
0
        public async Task <IHttpActionResult> GetFavorites(string username)
        {
            try
            {
                var products = await crudOnFavorites.GetUsersFavoriteProducts(username);

                var viewProducts = Mapper.Map <IEnumerable <ViewProduct> >(products);

                return(Ok(viewProducts));
            }
            catch (Exception ex)
            {
                return(throwExceptionToUser.Throw(ex));
            }
        }