Esempio n. 1
0
        public void Cannot_execute_PaymentSettingsQueries_without_permissions()
        {
            // Arrange
            LogWithNewAdmin(Modules.PaymentSettings, Permissions.View);

            // Act
            Assert.Throws <InsufficientPermissionsException>(() => _paymentSettingsQueries.SaveSetting(new SavePaymentSettingsCommand()));
        }
        public string Save(SavePaymentSettingsCommand model)
        {
            try
            {
                var result = _paymentSettingsQueries
                             .SaveSetting(model);

                return(SerializeJson(new
                {
                    Result = "success",
                    Data = result.Message,
                    Id = result.PaymentSettingsId
                }));
            }
            catch (RegoException regoEx)
            {
                return(SerializeJson(new { Result = "failed", Data = regoEx.Message }));
            }
            catch (ValidationError e)
            {
                return(SerializeJson(new { Result = "failed", Data = e.ErrorMessage }));
            }
        }