示例#1
0
 public ActionResult Edit(Theme newTheme)
 {
     if (ModelState.IsValid)
     {
         if (repo.EditTheme(newTheme) > 0)
             return RedirectToAction("Index");
         else
             ModelState.AddModelError("", "Provider error");
     }
     return View(newTheme);
 }
示例#2
0
 /// <summary>
 /// Create new theme
 /// </summary>
 /// <param name="newTheme">New theme</param>
 /// <returns>0 - if creating fail</returns>
 public int CreateTheme(Theme newTheme)
 {
     modelContainer.Themes.Add(newTheme);
     return modelContainer.DbSaveChanges();
 }
示例#3
0
 /// <summary>
 /// Edit theme
 /// </summary>
 /// <param name="newTheme">New data</param>
 /// <returns>0 - if editing fail</returns>
 public int EditTheme(Theme newTheme)
 {
     Theme Theme = modelContainer.Themes.FirstOrDefault(b => b.Id == newTheme.Id);
     if (Theme != null)
     {
         Theme.ThemeName = newTheme.ThemeName;
         return modelContainer.DbSaveChanges();
     }
     return 0;
 }