public object Allocation(string guid, string[] values) { var json = new ResJson() { success = false }; try { var db = sysAdminService.GetDb(); try { db.Ado.BeginTran(); db.Deleteable <SysRoleAssignments>(p => p.Admin_GUID == guid).ExecuteCommand(); if (values != null && values.Length > 0) { var datas = new List <SysRoleAssignments>(); foreach (var value in values) { datas.Add(new SysRoleAssignments() { GUID = Guid.NewGuid().ToString(), Admin_GUID = guid, Role_GUID = value }); } db.Insertable(datas).ExecuteCommand(); } db.Ado.CommitTran(); json.message = "分配成功!"; json.success = true; } catch (Exception ex) { db.Ado.RollbackTran(); json.message = "分配失败!"; throw ex; } } catch (Exception ex) { json.message = "网络超时."; throw ex; } return(Json(json)); }