public void TcUpdatePGroupRole() { List <Role> listRole = _provider.getAllRole(); List <Role> role = new List <Role>(); listRole[0].Checked = true; listRole[1].Checked = true; role.Add(listRole[0]); role.Add(listRole[1]); Assert.AreEqual(_provider.updatePGroupRole(4, role.ToArray()), true); Assert.AreEqual(_provider.updatePGroupRole(1000, role.ToArray()), false); }
public JsonResult PRole(int ID) { List <Role> getAllRole = _provider.getAllRole(); Role[] OwnPermission = _provider.GetAllRoleOfGroupByID(ID); foreach (Role item in getAllRole) { if (OwnPermission.Where(s => s.ID == item.ID).Count() == 1) { item.Checked = true; } } return(Json(new { success = true, content = ReflectionHelper.ArrayModelToArrObject(getAllRole.ToArray()) }, JsonRequestBehavior.AllowGet)); }