Saturday, November 23, 2024 1:58:05 PM
public virtual IList<Picture> GetPicturesByProductId(int productId, int recordsToReturn = 0)
{
if (productId == 0)
return new List<Picture>();
var query = from p in _pictureRepository.Table
join pp in _productPictureRepository.Table on p.Id equals pp.PictureId
orderby pp.DisplayOrder
where pp.ProductId == productId &&
(pp.IsPictogram == null || pp.IsPictogram == false) //new by Festemidler
select p;
if (recordsToReturn > 0)
query = query.Take(recordsToReturn);
var pics = query.ToList();
return pics;
}
--Picture
SELECT PM.ProductId,PM.DisplayOrder,P.Id,P.IsNew,P.MimeType,P.SeoFilename
FROM Product_Picture_Mapping PM WITH (NOLOCK),Picture P WITH (NOLOCK)
WHERE PM.PictureId=P.Id and PM.ProductId in (select ProductId from #ExportProducts)
ORDER BY PM.ProductId,PM.DisplayOrder ASC
--end Picture
--Picture
SELECT PM.ProductId,PM.DisplayOrder,P.Id,P.IsNew,P.MimeType,P.SeoFilename
FROM Product_Picture_Mapping PM WITH (NOLOCK),Picture P WITH (NOLOCK)
WHERE PM.PictureId=P.Id and PM.ProductId in (select ProductId from #ExportProducts)
and (pm.IsPictogram == null || pm.IsPictogram == false)
ORDER BY PM.ProductId,PM.DisplayOrder ASC
--end Picture