예제 #1
0
        public static async Task <List <dynamic> > SearchSampleVertexQuery(string name, string email)
        {
            // If name and email is null, get public Beats
            if (string.IsNullOrWhiteSpace(name) && string.IsNullOrWhiteSpace(email))
            {
                string queryString = GetAllPublicVerticesQuery("sample");

                ResultSet <dynamic> result = await DatabaseConnection.Instance.ExecuteQuery(queryString);

                List <dynamic> resultList = await PopulatePlaylistLength(result);

                resultList = await PopulateVertexOwners(resultList);

                return(resultList);
            }
            // If name is not null and email is null, search public Beats
            else if (!string.IsNullOrWhiteSpace(name) && string.IsNullOrWhiteSpace(email))
            {
                string queryString = SearchPublicVertexQuery("sample", name);

                ResultSet <dynamic> result = await DatabaseConnection.Instance.ExecuteQuery(queryString);

                List <dynamic> resultList = await PopulatePlaylistLength(result);

                resultList = await PopulateVertexOwners(resultList);

                return(resultList);
            }
            // If name is null and email is not null, get public and owned Beats
            else if (string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(email))
            {
                string queryStringPublic  = GetAllPublicVerticesQuery("sample");
                string queryStringPrivate = GetAllOwnedVerticesQuery("sample", email);

                ResultSet <dynamic> resultsPublic = await DatabaseConnection.Instance.ExecuteQuery(queryStringPublic);

                ResultSet <dynamic> resultsPrivate = await DatabaseConnection.Instance.ExecuteQuery(queryStringPrivate);

                List <dynamic> resultList = await PopulateVertexOwners(resultsPublic.Concat(resultsPrivate));

                return(resultList);
            }
            // If name and email is not null, search public and owned Beats
            else
            {
                string queryStringPublic  = SearchPublicVertexQuery("sample", name);
                string queryStringPrivate = SearchOwnedVertexQuery("sample", email, name);

                ResultSet <dynamic> resultsPublic = await DatabaseConnection.Instance.ExecuteQuery(queryStringPublic);

                ResultSet <dynamic> resultsPrivate = await DatabaseConnection.Instance.ExecuteQuery(queryStringPrivate);

                List <dynamic> resultList = await PopulateVertexOwners(resultsPublic.Concat(resultsPrivate));

                return(resultList);
            }
        }