Ejemplo n.º 1
0
        public async Task <IActionResult> GetPicutresByPartner(int crmPartnerId)
        {
            var pictureFolders = _pictureRepository.GetPartnerPictures(crmPartnerId);

            if (pictureFolders == null)
            {
                return(NotFound(crmPartnerId));
            }
            try
            {
                foreach (var folder in pictureFolders)
                {
                    foreach (var picture in folder.Pictures)
                    {
                        picture.FileUrl = await _azureStorageService.GetPictureUrlAsync(_picturesContainerName, picture.PictureName, crmPartnerId, folder.PictureFolderId);
                    }
                }
            }
            catch (Exception)
            {
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
            return(Ok(pictureFolders));
        }
Ejemplo n.º 2
0
        public async Task <string> GetPictureUrlAsync(string pictureName, int crmPartnerId, int pictureFolderId)
        {
            string result = string.Empty;

            try
            {
                result = await _azureStorageService.GetPictureUrlAsync(_picturesContainerName, pictureName, crmPartnerId, pictureFolderId);
            }
            catch (Exception)
            {
                // currently not throwing any exception
                result = "Not able to reterive image";
            }

            return(result);
        }