/// <summary> /// /// </summary> /// <param name="id"></param> /// <returns></returns> public static bool DeletePermanent(int id) { // delete menus in role MenuRoleServices.Delete(id, null); // delete users in role UserRoleServices.Delete(id, null); // delete role return(Delete(id)); }
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); } }
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ý"); } }