public IActionResult Delete(DeleteEmployeeViewModel employee) { if (ModelState.IsValid) { projectService.DeleteEmployee(employee.ID); return(RedirectToAction("Index")); } return(View(employee)); }
public IActionResult Delete(DeleteEmployeeViewModel model) { _userAppService.DeleteUserById(model.Id); return(Json(new JsonResultEntity() { Message = "删除员工帐号成功!", JsonObject = new JsonResult(new { id = model.Id }) })); }
public async Task <IActionResult> Delete(DeleteEmployeeViewModel model) { var success = await this.employeesService.RemoveAsync(model.Id); if (!success) { return(this.RedirectToAction("Error", "Home")); // TODO: redirect } return(this.RedirectToAction("All", "Employees")); }
public async Task <IActionResult> Delete(DeleteEmployeeViewModel viewModel) { var data = await _context.Employees.FirstOrDefaultAsync(x => x.EmployeeId == viewModel.Id); if (data is null) { return(View(new DeleteEmployeeViewModel(viewModel.Id, "Użytkownik nie istnieje w sytstemie"))); } _context.Employees.Remove(data); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); }
public IActionResult Delete(int id, DeleteEmployeeViewModel model) { if (_userAppService.IsSuperManager(id, out UserModel user)) { var msg = "超级管理账户不能删除"; return(Json(new JsonResultEntity() { IsSuccessed = false, Message = msg })); } model = new DeleteEmployeeViewModel() { Id = user.Id, UserName = user.UserName, }; return(PartialView("_Delete", model)); }
public IActionResult Delete(string id) { EmployeeServiceModel employee = this.employeesService.GetById(id); if (employee.FullName == null) { return(this.BadRequest()); } var model = new DeleteEmployeeViewModel { Id = employee.Id, FullName = employee.FullName, OperatingLocation = employee.OperatingLocation, JobPosition = employee.JobPosition, }; return(this.View(model)); }