public DeleteConfirmationViewModel DeleteConfirmationForm(int id)
        {
            NoiseProtectionDefinition   definintion = _noiseProtectionDefinitionDAO.Get(id);
            DeleteConfirmationViewModel viewModel   = new DeleteConfirmationViewModel
            {
                Id    = definintion.Id.ToString(CultureInfo.InvariantCulture),
                Title = definintion.SystemName
            };

            return(viewModel);
        }
        public GenericDefinitionViewModel Edit(int id, GenericDefinitionEditModel editModel)
        {
            NoiseProtectionDefinition definition = _noiseProtectionDefinitionDAO.Get(id);

            definition.SystemName = editModel.Title;

            _noiseProtectionDefinitionDAO.Store(definition);

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

            return(viewModel);
        }
        public GenericDefinitionViewModel Create(GenericDefinitionEditModel editModel)
        {
            NoiseProtectionDefinition definition = new NoiseProtectionDefinition
            {
                SystemName = editModel.Title
            };

            _noiseProtectionDefinitionDAO.Store(definition);

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

            return(viewModel);
        }
Beispiel #4
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);
        }
        public void Delete(int id)
        {
            NoiseProtectionDefinition noiseProtectionDefinition = _noiseProtectionDefinitionDAO.Load(id);

            _noiseProtectionDefinitionDAO.Delete(noiseProtectionDefinition);
        }