Class FavoriteProductService
- Assembly
 - Dynamicweb.Ecommerce.dll
 
public class FavoriteProductService : ICacheStorage<int, List<FavoriteProduct>>, ICacheStorage<int>, ICacheStorage
  - Inheritance
 - 
      
      FavoriteProductService
 
- Implements
 
- Inherited Members
 
Methods
AddProductToFavoriteList(int, string, string, int)
Add the specified product into a favorite list.
  
  public void AddProductToFavoriteList(int userId, string productId, string productVariantId, int favoriteListId = 0)
  Parameters
userIdint- The id of user
 productIdstring- The product identifier
 productVariantIdstring- The product variant identifier
 favoriteListIdint- The identifier of a favorite list
 
Remarks
If a FavoriteListId Is provided, the product should be added To that FavoriteList otherwise,
the product should just be added To the Default favorite list For the current user (If it doesn't exist, it should be created).
  
  AddProductToFavoriteList(int, string, string, string, string, int, int)
Add the specified product into a favorite list.
  
  public void AddProductToFavoriteList(int userId, string productId, string productVariantId, string referenceUrl, string note, int favoriteListId = 0, int quantity = 1)
  Parameters
userIdint- The id of user
 productIdstring- The product identifier
 productVariantIdstring- The product variant identifier
 referenceUrlstring- The reference url
 notestring- The customer note
 favoriteListIdint- The identifier of a favorite list
 quantityint
Remarks
If a FavoriteListId Is provided, the product should be added To that FavoriteList otherwise,
the product should just be added To the Default favorite list For the current user (If it doesn't exist, it should be created).
  
  ClearCache()
Resets all keys to the default value for objects stored in the object cache
  
  public void ClearCache()
  ClearCache(IEnumerable<int>)
Resets the specified keys to the default value for objects stored in the object cache
  
  public void ClearCache(IEnumerable<int> keys)
  Parameters
keysIEnumerable<int>- Keys to reset
 
ClearCache(int)
Resets the specified key to the default value for objects stored in the object cache
  
  public void ClearCache(int key)
  Parameters
keyint- Key to reset
 
Delete(FavoriteProduct)
Deletes the favorite product.
  
  public void Delete(FavoriteProduct favoriteProduct)
  Parameters
favoriteProductFavoriteProduct- The favorite product.
 
GetFavoriteProducts(int)
Gets products by favorites list id.
  
  public IEnumerable<FavoriteProduct> GetFavoriteProducts(int favoriteListId)
  Parameters
favoriteListIdint- The id of favorites list.
 
Returns
- IEnumerable<FavoriteProduct>
 - The products in favorites list
 
RemoveProductFromFavoriteList(int, string, string, int)
Remove the specified product from a favorite list.
  
  public void RemoveProductFromFavoriteList(int userId, string productId, string productVariantId, int favoriteListId)
  Parameters
userIdint- The id of user
 productIdstring- The product identifier
 productVariantIdstring- The product variant identifier
 favoriteListIdint- The identifier of a favorite list
 
Remarks
In this action, there's a number of different actions that should be performed depending on the parameters.
- If both the ProductId And ProductVariantId Is provided, the specific variant should be removed from the favorite list matching the provided FavoriteListId.
- If only the ProductId Is provided, all products/variants matching that ProductId should be removed from the favorite list matching the provided FavoriteListId.
  
  Save(FavoriteProduct)
Saves the favorite product.
  
  public void Save(FavoriteProduct favoriteProduct)
  Parameters
favoriteProductFavoriteProduct- The favorite product.