public JsonResult Create(FormCollection form)
 {
     ResultBase_form result = new ResultBase_form();
     IList<Authority> items = new List<Authority>();
     Role m = new Role();
     TryUpdateModel<Role>(m, form);
     foreach (var item in form["authIds"].Split('|'))
     {
         items.Add(AuthorityService.instance().GetEnumByID(new Guid(item)).FirstOrDefault());
     }
     m.Item_Authoritys = items;
     if (m.ID == Guid.Empty)
         result.status = RoleService.instance().Insert(m);
     else
         result.status = RoleService.instance().Update(m);
     result.msg = result.status == 0 ? "操作失败" : "操作成功";
     result.ResultURL = "/Role/Index";
     return Json(result, JsonRequestBehavior.AllowGet);
 }
 public ActionResult Create(string id)
 {
     Role m;
     if (string.IsNullOrEmpty(id))
         m = new Role();
     else
     {
         m = RoleService.instance().GetEnumByID(new Guid(id)).FirstOrDefault();
         m.Item_Authoritys.Each(n =>
         {
             m.Item_AuthorityIDs = m.Item_AuthorityIDs + "|" + n.ID;
         });
         if (m.Item_Authoritys.Count() > 0)
         {
             m.Item_AuthorityIDs = m.Item_AuthorityIDs.Substring(1);
         }
     }
     return View(m);
 }