Beispiel #1
0
        /// <summary>
        /// Get Count of Images
        /// </summary>
        /// <returns>Number of Images</returns>
        public int AmountOfItems()
        {
            var numberOfImages = 0;
            var fileSystem     = _fileSystemProviderRepository.GetFileSystem();

            if (fileSystem != null)
            {
                if (fileSystem.Type.Contains("PhysicalFileSystem"))
                {
                    numberOfImages = Directory
                                     .EnumerateFiles(HostingEnvironment.MapPath("/media/"), "*.*", SearchOption.AllDirectories)
                                     .Count(file => !file.ToLower().EndsWith("config"));
                }
                else
                {
                    _blobStorage.SetDataForBlobStorage();
                    if (_blobStorage.DoesContainerExist())
                    {
                        numberOfImages = _blobStorage.CountBlobsInContainer();
                    }
                }
            }

            return(numberOfImages);
        }