public int GetProductIdFromCode(string code) { ICatalogSystem catalog = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance <ICatalogSystem>(); CatalogEntryResponseGroup responseGroup = new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryInfo); CatalogEntryDto entryDto = catalog.GetCatalogEntryDto(code, responseGroup); if (entryDto == null || entryDto.CatalogEntry.Rows.Count == 0) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(entryDto.CatalogEntry[0].CatalogEntryId); }
public CatalogEntryDto Get(int productId) { ICatalogSystem catalog = EPiServer.ServiceLocation.ServiceLocator.Current.GetInstance <ICatalogSystem>(); CatalogEntryResponseGroup responseGroup = new CatalogEntryResponseGroup(CatalogEntryResponseGroup.ResponseGroup.CatalogEntryFull); CatalogEntryDto entryDto = catalog.GetCatalogEntryDto(productId, responseGroup); if (entryDto == null || entryDto.CatalogEntry.Rows.Count == 0) { throw new HttpResponseException(HttpStatusCode.NotFound); } return(entryDto); }
public CatalogEntryDto.CatalogEntryRow GetCatalogEntry(int catalogEntryId) { return(_catalogSystem.GetCatalogEntryDto(catalogEntryId).CatalogEntry.FirstOrDefault()); }
/// <summary> /// Gets the catalog entry dto. /// </summary> /// <param name="catalogEntryId">The catalog entry id.</param> /// <returns></returns> public CatalogEntryDto GetCatalogEntryDto(int catalogEntryId) { return(_Proxy.GetCatalogEntryDto(catalogEntryId)); }