public static MessageResult AssembleContentsPreAction(int id) { var site = SiteRepository.GetById(id); var message = !site.IsLive ? null : string.Format(SiteStrings.SiteInLiveWarning, site.ModifiedToDisplay, site.LastModifiedByUserToDisplay); return(string.IsNullOrEmpty(message) ? null : MessageResult.Confirm(message)); }
public MessageResult AssemblePagePreAction(int id) { var site = PageRepository.GetPagePropertiesById(id).PageTemplate.Site; var message = !site.IsLive ? null : string.Format(SiteStrings.SiteInLiveWarning, site.ModifiedToDisplay, site.LastModifiedByUserToDisplay); return(string.IsNullOrEmpty(message) ? null : MessageResult.Confirm(message)); }
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)); }
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)); }
public MessageResult SetArchiveFlag(int contentId, int[] articleIds, bool flag) { foreach (int articleId in articleIds) { Articles[articleId].Archived = flag; } return(MessageResult.Confirm("")); }
public override MessageResult PreAction(int dbId, int siteId) { var site = GetSite(siteId); if (site.IsLive) { return(MessageResult.Confirm(SiteStrings.AssembleLiveSiteConfirmation, new[] { siteId })); } return(null); }
public static MessageResult RemovePreAction(int id) { var folder = FolderFactory.Create(EntityTypeCode.ContentFolder).CreateRepository().GetById(id); if (folder.IsEmpty) { return(MessageResult.Confirm(string.Format(FolderStrings.FolderIsNotEmptyConfirm, folder.Name), new[] { id })); } return(null); }
public MessageResult MultipleAssemblePagePreAction(int[] ids) { if (ids == null) { throw new ArgumentNullException(nameof(ids)); } var site = PageRepository.GetPagePropertiesById(ids[0]).PageTemplate.Site; var message = !site.IsLive ? null : string.Format(SiteStrings.SiteInLiveWarning, site.ModifiedToDisplay, site.LastModifiedByUserToDisplay); return(string.IsNullOrEmpty(message) ? null : MessageResult.Confirm(message)); }
public override MessageResult PreAction(int parentId, int templateId) { var site = SiteRepository.GetById(parentId); if (site == null) { return(MessageResult.Error(string.Format(SiteStrings.SiteNotFound, parentId), new[] { parentId })); } if (site.IsLive) { return(MessageResult.Confirm(TemplateStrings.AssembleLiveSiteTemplateConfirmation, new[] { parentId })); } return(null); }
public MessageResult RemovePreAction(int id) { var group = UserGroupRepository.GetPropertiesById(id); if (group == null) { throw new ApplicationException(string.Format(UserGroupStrings.GroupNotFound, id)); } if (group.ChildGroups.Any()) { return(MessageResult.Confirm(UserGroupStrings.ConfirmHasChildren)); } return(null); }
public ActionResult ExecutePreAction(string tabId, int parentId, [FromBody] CustomActionQuery query) { var msg = $"Action: {query.ActionCode}, ParentId: {parentId}, IDs: {string.Join(";", query.Ids)}"; return(Json(MessageResult.Confirm(msg))); }
public MessageResult Delete(int articleId) { Articles.Remove(articleId); return(MessageResult.Confirm("")); }
public MessageResult Publish(int contentId, int[] articleIds) { return(MessageResult.Confirm("")); }
public ActionResult ExecutePreAction(string tabId, int parentId, int[] ids, string actionCode) => Json(MessageResult.Confirm($"Action: {actionCode}, ParentId: {parentId}, IDs: {string.Join(";", ids)}"));