public IPartialView GetPartialView(string path) { using (var scope = ScopeProvider.CreateScope(autoComplete: true)) { return(_partialViewRepository.Get(path)); } }
private bool DeletePartialViewMacro(string path, PartialViewType partialViewType, int?userId = null) { using (ICoreScope scope = ScopeProvider.CreateCoreScope()) { IPartialViewRepository repository = GetPartialViewRepository(partialViewType); IPartialView? partialView = repository.Get(path); if (partialView == null) { scope.Complete(); return(true); } EventMessages eventMessages = EventMessagesFactory.Get(); var deletingNotification = new PartialViewDeletingNotification(partialView, eventMessages); if (scope.Notifications.PublishCancelable(deletingNotification)) { scope.Complete(); return(false); } userId ??= Constants.Security.SuperUserId; repository.Delete(partialView); scope.Notifications.Publish(new PartialViewDeletedNotification(partialView, eventMessages).WithStateFrom(deletingNotification)); Audit(AuditType.Delete, userId.Value, -1, partialViewType.ToString()); scope.Complete(); } return(true); }