private void SetDeleteStatus(IMediaDetail detail, bool isDeleted) { UserMustHaveAccessTo(detail); if (!FrameworkSettings.CurrentUser.HasPermission(PermissionsEnum.Delete)) { throw new Exception("You do not have the appropriate permissions to delete/undelete items"); } detail = BaseMapper.GetObjectFromContext((MediaDetail)detail); detail.IsDeleted = isDeleted; Return returnObj = MediaDetailsMapper.Update(detail); if (returnObj.IsError) { throw returnObj.Error.Exception; } else { ContextHelper.ClearAllMemoryCache(); detail.RemoveFromCache(); FileCacheHelper.DeleteCacheDir("generatenav"); } }
private Return SetPublishStatus(MediaDetail detail, bool publishStatus) { if ((detail == null) || (detail.IsPublished == publishStatus)) { return(new Return()); } detail = BaseMapper.GetObjectFromContext(detail); if (publishStatus) { detail.PublishDate = DateTime.Now; } else { detail.PublishDate = null; } Return returnObj = MediaDetailsMapper.Update(detail); if (returnObj.IsError) { return(returnObj); } else { ContextHelper.ClearAllMemoryCache(); FileCacheHelper.DeleteCacheDir("generatenav"); if (publishStatus) { detail.PublishDate = DateTime.Now; returnObj = detail.RunOnPublishExecuteCode(); return(returnObj); } return(returnObj); } }
private void SetShowInMenuStatus(MediaDetail detail, bool showInMenu) { if ((detail == null) || (detail.ShowInMenu == showInMenu)) { return; } detail = BaseMapper.GetObjectFromContext(detail); detail.ShowInMenu = showInMenu; Return returnObj = MediaDetailsMapper.Update(detail); if (returnObj.IsError) { throw returnObj.Error.Exception; } else { ContextHelper.ClearAllMemoryCache(); FileCacheHelper.DeleteCacheDir("generatenav"); } }