public ActionResult peAppWvUsers_Destroy([DataSourceRequest] DataSourceRequest request, UserVm vm) { if (ModelState.IsValid) { var entity = new peAppWvUser { Id = vm.Id, code = vm.code, name = vm.name, dept = vm.dept, SubDept = vm.SubDept, password = vm.password }; db.peAppWvUsers.Attach(entity); db.peAppWvUsers.Remove(entity); db.SaveChanges(); } return(Json(new[] { vm }.ToDataSourceResult(request, ModelState))); }
public ActionResult peAppWvUsers_Create([DataSourceRequest] DataSourceRequest request, UserVm vm) { if (ModelState.IsValid) { var entity = new peAppWvUser { code = vm.code, name = vm.name, // 6个1 password = "******", dept = vm.dept, SubDept = vm.SubDept, }; db.peAppWvUsers.Add(entity); db.SaveChanges(); vm.Id = entity.Id; } return(Json(new[] { vm }.ToDataSourceResult(request, ModelState))); }