Пример #1
0
        public async Task <ActionResult <ResetResult> > Reset()
        {
            if (!await _authManager.HasAppPermissionsAsync(Types.AppPermissions.SettingsUsersStyle))
            {
                return(Unauthorized());
            }

            await _tableStyleRepository.DeleteAllAsync(_userRepository.TableName);

            var allAttributes = _userRepository.TableColumns.Select(x => x.AttributeName).ToList();

            var styles = new List <InputStyle>();

            foreach (var style in await _tableStyleRepository.GetUserStylesAsync())
            {
                styles.Add(new InputStyle
                {
                    Id            = style.Id,
                    AttributeName = style.AttributeName,
                    DisplayName   = style.DisplayName,
                    InputType     = style.InputType,
                    Rules         = TranslateUtils.JsonDeserialize <List <InputStyleRule> >(style.RuleValues),
                    Taxis         = style.Taxis,
                    IsSystem      = ListUtils.ContainsIgnoreCase(allAttributes, style.AttributeName)
                });
            }

            return(new ResetResult
            {
                Styles = styles
            });
        }
Пример #2
0
        public async Task DeleteAsync(int siteId, int formId)
        {
            if (formId <= 0) return;

            var formInfo = await _formRepository.GetFormInfoAsync(siteId, formId);
            var relatedIdentities = GetRelatedIdentities(formInfo.Id);

            await _tableStyleRepository.DeleteAllAsync(FormUtils.TableNameData, relatedIdentities);
            await _dataRepository.DeleteByFormIdAsync(formId);
            await _formRepository.DeleteAsync(siteId, formId);
        }
Пример #3
0
        public async Task DeleteAsync(int siteId)
        {
            if (siteId <= 0)
            {
                return;
            }

            var relatedIdentities = new List <int> {
                siteId
            };

            await _tableStyleRepository.DeleteAllAsync(CommentUtils.TableName, relatedIdentities);

            await _commentRepository.DeleteBySiteIdAsync(siteId);

            await _settingsRepository.DeleteAsync(siteId);
        }