Exemplo n.º 1
0
        public CustomFormat Insert(CustomFormat customFormat)
        {
            var ret = _formatRepository.Insert(customFormat);

            try
            {
                ProfileService.AddCustomFormat(ret);
            }
            catch (Exception e)
            {
                _logger.Error(e, "Failure while trying to add the new custom format to all profiles. Deleting again!");
                _formatRepository.Delete(ret);
                throw;
            }
            _cache.Clear();
            return(ret);
        }
Exemplo n.º 2
0
        public void Delete(int id)
        {
            var format = _formatRepository.Get(id);

            // Remove from profiles before removing from DB
            _eventAggregator.PublishEvent(new CustomFormatDeletedEvent(format));

            _formatRepository.Delete(id);
            _cache.Clear();
        }