コード例 #1
0
        public PortfolioController(AppDbContext context, IHostEnvironment env, ILogger <PortfolioController> logger, IFileInsider fileInsider)
        {
            _context     = context;
            _env         = env;
            _logger      = logger;
            _fileInsider = fileInsider;

            string dir = AppDomain.CurrentDomain.BaseDirectory;

            if (_env.IsDevelopment())
            {
                string appName           = AppDomain.CurrentDomain.FriendlyName;
                string appDevelopmentDir = dir.Substring(0, dir.LastIndexOf(appName)) + appName;
                _publicDir = appDevelopmentDir.Replace(@"\", "/") + "/ClientApp/public";
                _saveDir   = _publicDir + "/img/uploads/";
            }
            else
            {
                _publicDir = dir.Replace(@"\", "/") + "/ClientApp/build";
                _saveDir   = _publicDir + "/img/uploads/";
            }
        }
コード例 #2
0
 public ContactController(IOptions <AdminSettings> options, ILogger <ContactController> logger, IFileInsider fileInsider)
 {
     _appSettings = options.Value;
     _logger      = logger;
     _fileInsider = fileInsider;
 }