コード例 #1
0
        public async Task <IActionResult> Post([FromBody] GraphQLQuery query)
        {
            var schema = new Schema {
                Query = new VeterinaryQuery()
            };

            masterContext masterContext = new masterContext();

            var result = await new DocumentExecuter().ExecuteAsync(_ =>
            {
                _.Schema      = schema;
                _.Query       = query.Query;
                _.UserContext = masterContext;
            }).ConfigureAwait(false);


            if (result.Errors?.Count > 0)
            {
                return(BadRequest());
            }

            masterContext.Dispose();

            return(Ok(result));
        }