private Manifest ReadManifest(XmlElement xmlModule, IDictionary <string, Role> roleDb) { Manifest manifest = new Manifest(); foreach (XmlElement xmlChild in xmlModule.ChildNodes) { if (xmlChild.Name.Equals("RoleList")) { RoleList roleList = new RoleList(); foreach (XmlElement xmlRole in xmlChild.ChildNodes) { if (!xmlRole.Name.Equals("Role")) { throw new Exception("child of RoleList shouldn't be " + xmlRole.Name); } string roleName = xmlRole.GetAttribute("Name"); if (!roleDb.ContainsKey(roleName.ToLower())) { throw new Exception("unknown role name: " + roleName); } roleList.AddRole(roleDb[roleName.ToLower()]); } string optional = xmlChild.GetAttribute("Optional"); roleList.Optional = (optional.ToLower().Equals("true")); manifest.AddRoleList(roleList); } } return(manifest); }
public ActionResult Create(RoleClass role) { if (ModelState.IsValid) { RoleList accList = new RoleList(); accList.AddRole(role); return(RedirectToAction("Index")); } return(View()); }