Пример #1
0
        private static MessageResult MultipleConfirmHasChildren(IEnumerable <int> ids, bool countArchived)
        {
            var parentIds = ids.Where(id => ArticleRepository.CountChildren(id, countArchived) != 0).ToList();
            var format    = countArchived ? ArticleStrings.WarningHasChildrenMultiple : ArticleStrings.WarningHasNonArchiveChildrenMultiple;
            var message   = !parentIds.Any() ? null : string.Format(format, string.Join(", ", parentIds.ToArray()));

            return(string.IsNullOrEmpty(message) ? null : MessageResult.Confirm(message));
        }
Пример #2
0
        private static MessageResult ConfirmHasChildren(int articleId, bool countArchived)
        {
            var count   = ArticleRepository.CountChildren(articleId, countArchived);
            var format  = countArchived ? ArticleStrings.WarningHasChildren : ArticleStrings.WarningHasNonArchiveChildren;
            var message = count == 0 ? null : string.Format(format, count);

            return(string.IsNullOrEmpty(message) ? null : MessageResult.Confirm(message));
        }