public void ProcessFile() { XmlDocument XmlDoc = new XmlDocument(); XmlDoc.Load(FilePath); foreach (var Node in XmlDoc.DocumentElement.GetElementsByTagName("NavigationMenu")) { XmlElement Element = (XmlElement)Node; NavigationMenu NavMenu = new NavigationMenu(); NavMenu.KeyName = Element.GetElementsByTagName("KeyName")[0].InnerText; NavMenu.UserFriendlyName = Element.GetElementsByTagName("UserFriendlyName")[0].InnerText; ProcessChildLinks(Element, NavMenu.ChildNavLinks); NavigationMenuDAO.Save(NavMenu); } }
public ActionResult Edit_Post(string navigationMenuData) { try { NavigationMenu NavigationMenu = JsonConvert.DeserializeObject <NavigationMenu>(navigationMenuData); List <WebUserMessage> ErrorList = NavigationMenu.Validate(); //if passed validation if (ErrorList == null || ErrorList.Count == 0) { if (NavigationMenuDAO.Save(NavigationMenu)) { AddWebUserMessageToSession(Request, String.Format("Successfully saved/updated nav menu \"{0}\"", NavigationMenu.KeyName), SUCCESS_MESSAGE_TYPE); } else { AddWebUserMessageToSession(Request, String.Format("Unable to saved/update nav menu \"{0}\" at this time", NavigationMenu.KeyName), FAILED_MESSAGE_TYPE); } } //failed validation else { AddWebUserMessageToSession(Request, ErrorList); return(RedirectToAction("Edit", "NavMenu", new { navigationMenuData = navigationMenuData })); } return(RedirectToAction("Index", "Dashboard")); } catch (Exception e) { CompanyCommons.Logging.WriteLog("ChimeraWebsite.Areas.Admin.Controllers.NavMenuController.Edit_Post() " + e.Message); } AddWebUserMessageToSession(Request, String.Format("Unable to save/update navigation menus at this time."), FAILED_MESSAGE_TYPE); return(RedirectToAction("Index", "Dashboard")); }