Exemple #1
0
        public ActionResult CouchPotatoSettings()
        {
            var dto   = CpSettingsService.GetSettings();
            var model = new CouchPotatoSettingsViewModel();

            model.InjectFrom(dto);

            return(View(model));
        }
        public ActionResult CouchPotatoSettings(CouchPotatoSettingsViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            var dto = new CouchPotatoSettingsDto();

            dto.InjectFrom(viewModel);

            var result = CpSettingsService.SaveSettings(dto);

            if (result)
            {
                return(RedirectToAction("CouchPotatoSettings"));
            }

            return(View("Error"));
        }