public async Task <IActionResult> DelUser(UserViewModel data) { var username = HttpContext.Session.GetString("username"); bool result = await _userbll.DelUser(data, username); if (username == data.Email) { await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme); } return(Json(new { msg = result ? "删除成功" : "删除失败,请重试或刷新页面", code = result })); }
private void btn_HRMDelete_Click(object sender, EventArgs e) { DataGridViewSelectedRowCollection r = dgv_HRM.SelectedRows; if (r.Count == 1) { qLUserBLL.DelUser(int.Parse(r[0].Cells["IdUser"].Value.ToString())); loadDtbUser(); } else if (r.Count == 0) { MessageBox.Show("Please choose one row to delete!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Only one row can be chosen to delete!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// 删除用户 /// </summary> /// <param name="userId">员工编号</param> /// <returns></returns> public JsonResult DeleteUser(UserInfo user) { return(userBLL.DelUser(user.UserId)); }