public Dictionary <int, string> GetRoles(string mpAPIToken, int mpContactId) { Dictionary <int, string> rolesDict = new Dictionary <int, string>(); // Go get the roles from mp var columns = new string[] { "dp_User_Roles.Role_ID", "Role_ID_Table.Role_Name" }; var roles = _mpRestBuilder.NewRequestBuilder() .WithAuthenticationToken(mpAPIToken) .WithSelectColumns(columns) .WithFilter($"User_ID_Table_Contact_ID_Table.[Contact_ID]={mpContactId}") .Build() .Search <JObject>("dp_User_Roles"); if (roles == null) { return(rolesDict); } foreach (var role in roles) { rolesDict.Add(role.Value <int>("Role_ID"), role.Value <string>("Role_Name")); } return(rolesDict); }
private List <JObject> FetchData(string storedProcedureName, Dictionary <string, object> storedProcedureParameters = null) { var token = _apiUserRepository.GetDefaultApiClientToken(); // dp_Audit_Logs.Date_Time stores Utc return(_mpRestBuilder.NewRequestBuilder() .WithAuthenticationToken(token) .Build() .ExecuteStoredProc <JObject>(storedProcedureName, storedProcedureParameters ?? new Dictionary <string, object>()) .FirstOrDefault()); // unwraps/accommodates SQL Server's ability return multiple result sets in a single query represented as a list of lists }