Пример #1
0
        public void SaveMenusForRole(int roleId)
        {
            // get new list of menus for role
            var menusForRole = new JavaScriptSerializer().Deserialize <List <MenuRole> >(hdfMenusForRole.Text);

            // delete old menus for role
            MenuRoleServices.Delete(roleId, null);
            // insert new menus for role
            foreach (var menuRole in menusForRole)
            {
                MenuRoleServices.Create(menuRole);
            }
        }
Пример #2
0
 public void SaveMenuPermissionForRole()
 {
     // get role id
     if (!string.IsNullOrEmpty(hdfRoleId.Text) && int.TryParse(hdfRoleId.Text, out var roleId) && roleId > 0)
     {
         // get new list of menus for role
         var lstMenuRole = new JavaScriptSerializer().Deserialize <List <MenuRole> >(hdfMenuRole.Text);
         // delete old menus for role
         MenuRoleServices.Delete(roleId, null);
         // insert new menus for role
         foreach (var menuRole in lstMenuRole)
         {
             MenuRoleServices.Create(menuRole);
         }
         Dialog.ShowNotification("Lưu dữ liệu thành công");
     }
     else
     {
         Dialog.Alert("Có lỗi xảy ra trong quá trình xử lý");
     }
 }