Example #1
0
 public SiteGenerator(
     ILogger logger,
     TextBookerContext db,
     FileStoreSettings fileStoreSettings
     ) : base(logger)
 {
     this.db = db;
     this.fileStoreSettings = fileStoreSettings;
 }
Example #2
0
 public FileService(
     IMapper mapper,
     ILogger logger,
     TextBookerContext db,
     FileStoreSettings fileStoreSettings
     ) : base(logger)
 {
     this.mapper            = mapper;
     this.db                = db;
     this.fileStoreSettings = fileStoreSettings;
 }
Example #3
0
        /// <summary>
        /// Validates the File Store Settings
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        public static HttpResponseMessage ValidateFileStoreSettings(FileStoreSettings settings)
        {
            try
            {
                if (settings.FileStoreEnabled == null)
                {
                    throw new Exception();
                }

                if (string.IsNullOrEmpty(settings.FileStorePath))
                {
                    throw new Exception();
                }
                else
                {
                    FileStoreManager documentManager = new FileStoreManager();
                    if (!documentManager.ValidateDirectory(settings.FileStorePath))
                    {
                        throw new Exception();
                    }
                }

                if (string.IsNullOrEmpty(settings.FileStoreMinutes))
                {
                    throw new Exception();
                }

                if (string.IsNullOrEmpty(settings.FileDefinitionName))
                {
                    throw new Exception();
                }
            }
            catch (Exception exception)
            {
                logger.Error(exception);
                return(new HttpResponseMessage(HttpStatusCode.ExpectationFailed));
            }

            return(new HttpResponseMessage(HttpStatusCode.OK));
        }