/// <summary> /// Get the variants from a specific product content. The variants will be fetched from the property field using the "Tea Commerce: Variant editor" /// </summary> /// <param name="storeId">Id of the store.</param> /// <param name="model">The product as a IPublishedContent.</param> /// <param name="onlyValid">Fetch only the valid variants. A valid variant have one of each variant type and is not a duplicate.</param> /// <returns></returns> public static IEnumerable <VariantPublishedContent> GetVariants <T>(long storeId, T product, bool onlyValid = true) where T : class { IVariantService <T, VariantPublishedContent> variantService = DependencyContainer.Instance.Resolve <IVariantService <T, VariantPublishedContent> >(); return(variantService.GetVariants(storeId, product, onlyValid)); }
public async Task <IActionResult> GetVariants() { IEnumerable <VariantDTO> variants = await _variantService.GetVariants(); return(Ok(variants)); }