Example #1
0
        public async Task <string> GetPathFirstImage(int idProduct)
        {
            string filePath = string.Empty;

            var productImage = await _productImageRepository.GetFirstImage(idProduct);

            if (productImage != null)
            {
                string rootPath = $"{AppDomain.CurrentDomain.BaseDirectory}/{idProduct}";

                if (Directory.Exists(rootPath))
                {
                    filePath = $"{rootPath}/{productImage.Path}";
                }
            }

            return(filePath);
        }