Exemple #1
0
        public void bl_should_return_null_when_no_setting_was_found()
        {
            var key = Guid.NewGuid().ToString();

            var obj = _bl.CreateSetting();

            obj.Key = key;
            _bl.DeleteSetting(obj);
            var result = _bl.GetSetting(key);

            Assert.Null(result);
        }
Exemple #2
0
        public IActionResult DeleteSetting(string settingKey)
        {
            try
            {
                var setting = _bl.GetSetting(settingKey);

                if (setting == null)
                {
                    _log.LogWarning("Not Found: Setting '{0}' not found", settingKey);
                    return(NotFound());
                }

                _bl.DeleteSetting(setting);
                _bl.SaveChanges();
                _log.LogInformation("Setting '{0}' deleted by '{1}'", setting.Key, User.Identity.Name);
                return(Ok());
            }
            catch (Exception ex)
            {
                _log.LogError("Exception: '{0}'", ex);
                return(StatusCode(500));
            }
        }