public ActionResult EditEmployee(int bem_id) { EmployeeViewModel employeeViewModel = new EmployeeViewModel(); employeeViewModel.RuleSource = employeeBll.GetRoleList().Select(s => { return(new DtoKeyValue <string, string>() { key = s.Bro_code, value = s.Bro_Name }); }).ToList(); if (bem_id > 0) { var model = employeeBll.GetEmployeeEntity(bem_id); #region if (model != null) { employeeViewModel.Id = model.Bem_Id; employeeViewModel.Account = model.Bem_Account; employeeViewModel.Password = model.Bem_Password; employeeViewModel.Name = model.Bem_Name; employeeViewModel.Sex = model.Bem_Sex; employeeViewModel.Phone = model.Bem_Phone; employeeViewModel.Email = model.Bem_Email; employeeViewModel.Roles = model.Bem_Roles; employeeViewModel.Status = model.Bem_Status; employeeViewModel.Remark = model.Bem_Remark; employeeViewModel.TotalGrades = model.Bem_Grades; } #endregion } return(View(employeeViewModel)); }