Example #1
0
        private void removeOldMediaItems(ResultResponse res)
        {
            try
            {
                var deletedMediaItemIds = _mediaItemManager.DeleteOlderThan(DateTime.Now.AddDays(-30));

                foreach (var idCollection in deletedMediaItemIds)
                {
                    _orderItemManager.RemoveConnectionToMediaItem(idCollection.OrderItemId, idCollection.MediaItemId);
                }
            }
            catch (Exception e)
            {
                LogHelper.Error <SystemSurfaceController>("Failed to remove old media items.", e);
                res.Success  = false;
                res.Message += "Failed to remove old media items. ";
            }
        }