public ActionResult Kontakt() { if (Session["Rolle"] != null && Session["Rolle"].Equals("Admin")) { AdminI18nKontaktModel model = new AdminI18nKontaktModel(); return(View(model)); } return(RedirectToAction("Index", "Home")); }
public ActionResult KontaktEintragen(AdminI18nKontaktModel model) { if (Session["Rolle"] != null && Session["Rolle"].Equals("Admin")) { using (GastroEntities _db = new GastroEntities()) { //erst löschen wenn vorhanden List <I18n> liste = (from I18n i18n in _db.I18n where i18n.AllergenId == 1 && i18n.Typ == 9 select i18n).ToList(); _db.I18n.RemoveRange(liste); _db.I18n.Add(I18nHelper.CreateInstance(9, 5, 1, " ", "", model.Englisch_Einleitung, model.Englisch_Nachrichtentext, "", "", "")); _db.I18n.Add(I18nHelper.CreateInstance(9, 2, 1, " ", "", model.Italienisch_Einleitung, model.Italienisch_Nachrichtentext, "", "", "")); _db.I18n.Add(I18nHelper.CreateInstance(9, 3, 1, " ", "", model.Spanisch_Einleitung, model.Spanisch_Nachrichtentext, "", "", "")); _db.I18n.Add(I18nHelper.CreateInstance(9, 4, 1, " ", "", model.Russisch_Einleitung, model.Russisch_Nachrichtentext, "", "", "")); _db.SaveChanges(); } return(RedirectToAction("Kontakt", "Admin")); } return(RedirectToAction("Index", "Home")); }