Exemplo n.º 1
0
        public EditStaticTextViewModel GetText(string name, string scope)
        {
            //scope = m_dictionaryScopeResolver.GetDictionaryScope(scope);
            var staticText          = m_dynamicTextService.GetDynamicText(name, scope);
            var currentCultureLabel = m_localizationService.GetRequestCulture().NativeName;

            if (staticText == null)
            {
                return(new EditStaticTextViewModel
                {
                    Name = name,
                    Scope = scope,
                    IsRecordExists = false,
                    CultureNameLabel = currentCultureLabel,
                });
            }

            var staticTextViewModel = new EditStaticTextViewModel
            {
                Format                 = (StaticTextFormatType)staticText.Format,
                Name                   = staticText.Name,
                Scope                  = staticText.DictionaryScope,
                IsRecordExists         = true,
                LastModificationAuthor = staticText.ModificationUser,
                LastModificationTime   = staticText.ModificationTime,
                Text                   = staticText.Text,
                CultureNameLabel       = currentCultureLabel,
            };

            return(staticTextViewModel);
        }
Exemplo n.º 2
0
        public ActionResult SaveText([FromBody] EditStaticTextViewModel viewModel)
        {
            var username = GetUserName();
            var culture  = m_localizationService.GetRequestCulture();

            var modificationUpdate = m_staticTextManager.SaveText(viewModel.Name, viewModel.Scope, viewModel.Text, culture.Name, viewModel.Format, username);

            return(Json(modificationUpdate));
        }