public bool Delete(Guid id)
 {
     try
     {
         return(_repository.Delete(id));
     }
     catch (Exception ex)
     {
         _logger.LogError("Exception while deleting localization : {0} - {1} ", ex.StackTrace, ex.Message);
         throw ex;
     }
 }
        private void DeleteLocalizations(LocalizationSet localizationSet)
        {
            if (localizationSet.Localizations == null || localizationSet.Localizations.Count == 0)
            {
                return;
            }

            ILocalizationRepository localizationRepository = this.HttpContext.RequestServices.GetService <ILocalizationRepository>();
            Storage storage = this.HttpContext.RequestServices.GetService <Storage>();

            localizationRepository.Delete(localizationSet.Localizations);
            storage.SaveChanges();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Delete a language
        /// </summary>
        /// <param name="language"></param>
        public void Delete(Language language)
        {
            // Cannot delete default language
            if (language.Id == DefaultLanguage.Id)
            {
                throw new ApplicationException("Deleting the default language is not allowed.");
            }

            try
            {
                _localizationRepository.Delete(language);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(string.Format("Unable to delete language: {0}", ex.Message), ex);
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Delete a language
        /// </summary>
        /// <param name="language"></param>
        public void Delete(Language language)
        {
            // Cannot delete default language
            if (language.Id == DefaultLanguage.Id)
            {
                throw new ApplicationException("Deleting the default language is not allowed.");
            }

            try
            {
                _localizationRepository.Delete(language);
                _cacheService.ClearStartsWith(AppConstants.LocalisationCacheName);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(string.Format("Unable to delete language: {0}", ex.Message), ex);
            }
        }
        protected override ActionResult Delete()
        {
            try
            {
                using (var scope = new UnitOfWorkScope())
                {
                    Localization entity = _repository.Get(Convert.ToInt32(GridModel.Id));
                    _repository.Delete(entity);

                    scope.Commit();
                }

                return(new EmptyResult());
            }
            catch (Exception)
            {
                throw CreateModelException(GridModel);
            }
        }
Exemplo n.º 6
0
 public async Task Delete(string code)
 {
     await _localizationRepository.Delete(code);
 }