Exemple #1
0
        public void Handle(AddOrUpdateAppSettings command)
        {
            var company = _repository.Find(command.CompanyId);

            company.AddOrUpdateAppSettings(command.AppSettings);
            _repository.Save(company, command.Id.ToString());
        }
        public object Post(ExclusionsRequest request)
        {
            var settings = new Dictionary <string, string>
            {
                {
                    "IBS.ExcludedVehicleTypeId",
                    request.ExcludedVehicleTypeId == null
                        ? null
                        : string.Join(";", request.ExcludedVehicleTypeId.Select(x => x.ToString(CultureInfo.InvariantCulture)))
                },
                {
                    "IBS.ExcludedProviderId",
                    request.ExcludedProviderId == null
                        ? null
                        : string.Join(";", request.ExcludedProviderId.Select(x => x.ToString(CultureInfo.InvariantCulture)))
                }
            };

            var command = new AddOrUpdateAppSettings {
                AppSettings = settings, CompanyId = AppConstants.CompanyId
            };

            _commandBus.Send(command);
            _cacheClient.RemoveByPattern(string.Format("{0}*", ReferenceDataService.CacheKey));

            return(null);
        }
Exemple #3
0
        public object Post(ConfigurationsRequest request)
        {
            if (request.AppSettings.Any())
            {
                var command = new AddOrUpdateAppSettings
                {
                    AppSettings = request.AppSettings,
                    CompanyId   = AppConstants.CompanyId
                };
                _commandBus.Send(command);
            }

            return(new HttpResult(HttpStatusCode.OK, "OK"));
        }
Exemple #4
0
        private void SetAdminSettings(Dictionary <string, string> appSettings)
        {
            // Only the superadmin should be able to change the availability option of the settings.
            var isSuperAdmin = Convert.ToBoolean(ViewData["IsSuperAdmin"]);

            if (isSuperAdmin)
            {
                SetSettingsAvailableToAdmin(appSettings);
            }

            var command = new AddOrUpdateAppSettings
            {
                AppSettings = appSettings,
                CompanyId   = AppConstants.CompanyId
            };

            _commandBus.Send(command);
        }