public PageContent RestorePageContent(Guid id) { try { var result = _pageContentRepository.RestorePageContent(id); return(result); } catch (Exception ex) { _logger.LogError("Error occured while restoring page content", ex); } return(null); }
public async Task <IAdminResult> Restore(RecycleItem item) { if (item == null) { return(null); } object resultItem = null; switch (item.RecycleItemType.Name) { case "Layouts": var layout = _layoutRepository.GetLayout(item.Id); layout.IsActive = true; resultItem = _layoutRepository.UpdateLayout(layout); break; case "Page": var page = _pageRepository.GetPage(item.Id); page.IsActive = true; resultItem = _pageRepository.UpdatePageActiveAndLayout(page); break; case "PageContent": resultItem = _pageContentRepository.RestorePageContent(item.Id); break; case "PageModule": var pageModule = _pageRepository.GetPageModule(item.Id); pageModule.IsActive = true; resultItem = _pageRepository.UpdatePageModule(pageModule); break; } ; //_pageRepository.DeletePage(); if (resultItem != null) { return(await Task.FromResult(new AdminResult(resultItem) { IsSucceeded = true, SuccessMessage = $"{item.RecycleItemType.Name} has been restored" })); } return(await Task.FromResult(new AdminResult(resultItem) { IsSucceeded = false, SuccessMessage = $"Unable to restore {item.RecycleItemType.Name}" })); }
public PageContent RestorePageContent(Guid id) { var result = _pageContentRepository.RestorePageContent(id); return(result); }