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
userId
int- The id of user
productId
string- The product identifier
productVariantId
string- The product variant identifier
favoriteListId
int- 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
userId
int- The id of user
productId
string- The product identifier
productVariantId
string- The product variant identifier
referenceUrl
string- The reference url
note
string- The customer note
favoriteListId
int- The identifier of a favorite list
quantity
int
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
keys
IEnumerable<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
key
int- Key to reset
Delete(FavoriteProduct)
Deletes the favorite product.
public void Delete(FavoriteProduct favoriteProduct)
Parameters
favoriteProduct
FavoriteProduct- The favorite product.
GetFavoriteProducts(int)
Gets products by favorites list id.
public IEnumerable<FavoriteProduct> GetFavoriteProducts(int favoriteListId)
Parameters
favoriteListId
int- 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
userId
int- The id of user
productId
string- The product identifier
productVariantId
string- The product variant identifier
favoriteListId
int- 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
favoriteProduct
FavoriteProduct- The favorite product.