public void EditTest() { var initial = new Theme("Theme"); var expected = "ThemeEdit"; _themeService.AddTheme(initial); var toedit = _themeService.GetThemeByName("Theme"); toedit.Name = "ThemeEdit"; var result = _themeService.Edit(toedit); Assert.AreEqual(expected, result.Name); _themeService.DeleteTheme(result.ThemeId); }
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()); }