public void Save (int id, int idMenu, string translation) { Commons.CheckSuperUser(Session); Language[] langs = Language.FindAll(); foreach (Language l in langs) { MenuTranslation menuTranslation = MenuTranslation.FindByMenuAndLang(Menu.Find(idMenu), l); if (menuTranslation == null) menuTranslation = new MenuTranslation(); menuTranslation.Lang = l; menuTranslation.Translation = Request.Form[l.Id.ToString()]; menuTranslation.Menu = Menu.Find(idMenu); menuTranslation.Save(); } RedirectToAction("admin"); }
private static string ReadMenuTranslation(XmlNode node) { try { if (node.Name == "MenuTranslation") { string lang = NodeGetString(node, Constants.MENU_TRANSLATION_LANG); string translation = NodeGetString(node, Constants.MENU_TRANSLATION); Menu menu = (Menu)NodeGetObject(node, Constants.MENU_TRANSLATION_MENUCODE, menus); Language l = Language.FindByName(lang); MenuTranslation m = new MenuTranslation(l, menu, translation); m.Save(); menustranslations[lang] = m; System.Console.WriteLine ("Menu Translation: "+ translation); } return null; } catch(System.FormatException) { return "No se pudo leeer columna ordering"; } }