Exemplo n.º 1
0
        public ActionResult Add(ThemeView theme)
        {
            var result = _themeService.AddTheme(theme.Map());

            if (result != null)
            {
                TempData["Success"] = "Theme successfully created!";
                Logger.Log.Info($"Theme with Name - {theme.Name}, created successfully.");
                return(RedirectToAction("List"));
            }
            Logger.Log.Info($"Theme with Name - {theme.Name}, already exists!");
            TempData["Error"] = "Theme already exists!";
            return(View());
        }
Exemplo n.º 2
0
        public ActionResult Edit(ThemeView theme)
        {
            var result = _themeService.Edit(theme.Map());

            if (result != null)
            {
                TempData["Success"] = "Theme successfully modified!";
                Logger.Log.Info($"Theme with Name - {theme.Name}, modified.");
                return(RedirectToAction("List"));
            }

            ModelState.AddModelError("Name", "Theme already exists!");
            Logger.Log.Info($"Theme with Name - {theme.Name}, wasn`t modified!");
            TempData["Error"] = "Theme wasn`t modified!";
            return(View());
        }