Beispiel #1
0
        public GenericTranslationViewModel CreateNoiseProtectionForm(int definitionId)
        {
            GenericTranslationViewModel viewModel = new GenericTranslationViewModel(Thread.CurrentThread.CurrentCulture.Name)
            {
                DefinitionId = definitionId
            };

            return(viewModel);
        }
Beispiel #2
0
        public ActionResult Edit(GenericTranslationEditModel editModel)
        {
            if (editModel.IsValid() == false)
            {
                Response.StatusCode = 500;
                return(PartialView("_ValidationErrorSummary", new ValidationErrorSummaryViewModel(editModel.GetValidationErrors())));
            }

            GenericTranslationViewModel viewModel = _noiseProtectionService.Edit(editModel);

            return(PartialView("_GenericTranslationTableRow", viewModel));
        }
Beispiel #3
0
        public GenericTranslationViewModel EditNoiseProtectionForm(int id)
        {
            NoiseProtection noiseProtection = _noiseProtectionDAO.Get(id);

            GenericTranslationViewModel viewModel = new GenericTranslationViewModel(noiseProtection.CultureName)
            {
                Id           = noiseProtection.Id,
                DefinitionId = noiseProtection.NoiseProtectionDefinition.Id,
                Title        = noiseProtection.Title
            };

            return(viewModel);
        }
Beispiel #4
0
        public GenericTranslationViewModel Edit(GenericTranslationEditModel editModel)
        {
            NoiseProtection noiseProtection = _noiseProtectionDAO.Get(editModel.Id);

            noiseProtection.Title       = editModel.Title;
            noiseProtection.CultureName = editModel.SelectedCultureName;

            _noiseProtectionDAO.Store(noiseProtection);

            GenericTranslationViewModel viewModel = new GenericTranslationViewModel(noiseProtection.CultureName)
            {
                DefinitionId = noiseProtection.NoiseProtectionDefinition.Id,
                Id           = noiseProtection.Id,
                Title        = noiseProtection.Title
            };

            return(viewModel);
        }
Beispiel #5
0
        public GenericTranslationViewModel Create(GenericTranslationEditModel editModel)
        {
            NoiseProtectionDefinition definition = _noiseProtectionDefinitionDAO.Get(editModel.DefinitionId);

            NoiseProtection noiseProtection = new NoiseProtection
            {
                NoiseProtectionDefinition = definition,
                Title       = editModel.Title,
                CultureName = editModel.SelectedCultureName
            };

            definition.NoiseProtections.Add(noiseProtection);

            _noiseProtectionDefinitionDAO.Store(definition);

            GenericTranslationViewModel viewModel = new GenericTranslationViewModel(noiseProtection.CultureName)
            {
                DefinitionId = noiseProtection.NoiseProtectionDefinition.Id,
                Id           = noiseProtection.Id,
                Title        = noiseProtection.Title
            };

            return(viewModel);
        }
        public GenericDefinitionViewModel EditNoiseProtectionForm(int id)
        {
            NoiseProtectionDefinition definition = _noiseProtectionDefinitionDAO.Get(id);

            GenericDefinitionViewModel viewModel = new GenericDefinitionViewModel
            {
                Id                    = definition.Id,
                SystemName            = definition.SystemName,
                HasTranslationSupport = true
            };

            foreach (NoiseProtection noiseProtection in definition.NoiseProtections)
            {
                GenericTranslationViewModel translationViewModel = new GenericTranslationViewModel(noiseProtection.CultureName)
                {
                    Id    = noiseProtection.Id,
                    Title = noiseProtection.Title
                };

                viewModel.Translations.Add(translationViewModel);
            }

            return(viewModel);
        }
Beispiel #7
0
        public ActionResult Edit(int id)
        {
            GenericTranslationViewModel viewModel = _noiseProtectionService.EditNoiseProtectionForm(id);

            return(PartialView("_EditGenericTranslation", viewModel));
        }
Beispiel #8
0
        public ActionResult Create(int id)
        {
            GenericTranslationViewModel viewModel = _noiseProtectionService.CreateNoiseProtectionForm(id);

            return(PartialView("_CreateGenericTranslation", viewModel));
        }