Example #1
0
        public async Task <LocalizationContentResult> CreateLocalizationContent(ILocalizableContent <T, TContentType> input, bool overwrite, int?tenantId = null)
        {
            var cont         = AbpCinotamLocalizableContent.CreateLocalizableContent(input);
            var languageInDb =
                _localizationContentStore.LocalizableContents.FirstOrDefault(
                    a =>
                    a.Lang == input.Lang && a.EntityDtoName == input.EntityDtoName &&
                    a.EntityName == input.EntityName && a.EntityId == input.EntityId);

            if (languageInDb != null && !overwrite)
            {
                return(LocalizationContentResult.ContentExists);
            }

            if (overwrite && languageInDb != null)
            {
                languageInDb.Properties = cont.Properties;
                await _localizationContentStore.SaveContent(languageInDb, tenantId);

                return(LocalizationContentResult.ContentUpdated);
            }
            var id = await _localizationContentStore.SaveContent(cont, tenantId);

            return(id != 0 ? LocalizationContentResult.Success : LocalizationContentResult.Error);
        }