Example #1
0
        /// <summary>
        /// Exports entire dictionary to CSV
        /// </summary>
        /// <returns>A string containg the CSV items</returns>
        public string ExportDictionaryToCsv()
        {
            var dictionaryService = new DictionaryDataService(appContext);

            var csv = dictionaryService.GetAllDictionaryItemsSorted().ToCsv();

            return(csv);
        }
Example #2
0
        /// <summary>
        /// Imports the CSV dictionary back into Umbraco
        /// </summary>
        /// <param name="csv">The CSV entries</param>
        /// <returns></returns>
        public ImportResponse ImportCsv(string csv)
        {
            ImportResponse response = new ImportResponse
            {
                Validation = this.ValidateCsv(csv)
            };

            if (!response.Validation.IsValid)
            {
                return(response);
            }

            var dtos = response.Validation.CsvRows.ToLanguageTextDtos();

            var dictionaryService = new DictionaryDataService(appContext);

            response.Update = dictionaryService.UpdateDtoItems(dtos);

            return(response);
        }