public ActionResult UpdateEmployee(int id) { ViewData["Roles"] = Manage.GetRoles(); var r = new UpdateOrganizationUserModel(); var data = YunClient.Instance.Execute(new GerPermissionUserRequest { Id = id },Member.Token).User; if (data != null) { r.DisplayName = data.DisplayName; r.Email = data.Email; r.Entry = data.EntryTime; r.IdCard = data.IdCard; r.IsFemale = data.IsFemale ? 1 : 0; r.JobNum = data.JobNum; r.OrgId = (int)data.OrganizationId; r.OtherName = data.OtherName; r.Phone = data.Phone; r.Plane = data.Plane; r.Remark = data.Description; r.Roleids = data.Roles; r.UserName = data.UserName; r.WorkPlace = data.WorkPlace; return View(r); } TempData["error"] = "该职员不存在,请重新选择"; return RedirectToAction("Employees"); }
public ActionResult UpdateEmployee(int id, UpdateOrganizationUserModel model, FormCollection collection) { if (ModelState.IsValid) { var r = Manage.UpdateUserOrganization(collection["OrganizationId"].TryTo(0), 0, model.IdCard, collection["Role"], collection["EntryTime"].Is<DateTime>() ? collection["EntryTime"].TryTo<string, DateTime>().ToUnix() : 0, model.JobNum, model.OtherName, model.Phone, model.Email, model.Plane, model.WorkPlace, model.IsFemale == 1, model.DisplayName, id); TempData["success"] = "已成功修改职员信息"; return Json(r); } return Json(0); }