private static string ReadCategoryTranslation(XmlNode node) { try { if (node.Name == "CategoryTranslation") { string lang = NodeGetString(node, Constants.MENU_TRANSLATION_LANG); string translation = NodeGetString(node, Constants.CATEGORY_TRANSLATION); Category category = (Category)NodeGetObject(node, Constants.CATEGORY_TRANSLATION_CATEGORYCODE, categories); Language l = Language.FindByName(lang); CategoryTranslation ct = new CategoryTranslation(l, category, translation); ct.Save(); System.Console.WriteLine ("Category Translation: "+ translation); } return null; } catch(System.FormatException) { return "No se pudo leeer columna ordering"; } }
public void Save (int id, int idCategory, string translation) { Commons.CheckSuperUser(Session); Language[] langs = Language.FindAll(); foreach (Language l in langs) { CategoryTranslation categoryTranslation = CategoryTranslation.FindByCategoryAndLang(Category.Find(idCategory), l); if (categoryTranslation == null) categoryTranslation = new CategoryTranslation(); categoryTranslation.Lang = l; categoryTranslation.Translation = Request.Form[l.Id.ToString()]; categoryTranslation.Category = Category.Find(idCategory); categoryTranslation.Save(); } RedirectToAction("admin"); }