Beispiel #1
0
        public MarketingQuery(MarketingContext _marketingContext)
        {
            Name = "Marketing_Query";

            Field <ListGraphType <MaterialType> >("Materials",         //Endpoint ->  Example Request: {"query": "query{ materials{id,name} }" }
                                                  resolve: ctx => _marketingContext.GetMaterials());
            Field <ListGraphType <MaterialType> >("MeterialByBrandId", //Endpoint ->  Example Request: {"query": "query{ meterialByBrandId(id:1){id,name} }" }
                                                  arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> {
                    Name = "Id", Description = "Brand Id"
                }
            },
                                                  resolve: ctx => _marketingContext.GetMaterialsByBrandId(ctx.GetArgument <int>("Id")));
            Field <ListGraphType <BrandType> >("Brands", resolve: ctx => _marketingContext.GetBrands());
        }
        public BrandQuery(MarketingContext _marketingContext)
        {
            Name = "Brand_Query";

            Field <ListGraphType <BrandType> >("Brands", //TODO: Endpoint Name
                                               resolve: ctx => _marketingContext.GetBrands());
            Field <ListGraphType <BrandType> >("BrandByBrandId",
                                               arguments: new QueryArguments
            {
                new QueryArgument <IntGraphType> { //TODO: Endpoint Paramater
                    Name        = "Id",
                    Description = "Brand Id"
                }
            },
                                               resolve: ctx => _marketingContext.GetByBrandId(ctx.GetArgument <int>("Id")));
        }
Beispiel #3
0
 public MarketingQuery(MarketingContext _marketingContext)
 {
     Name = "Marketing_Query";
     //TODO: Graphql endpointlerini belirliyoruz.
     Field <ListGraphType <MaterialType> >("Materials",
                                           resolve: ctx => _marketingContext.GetMaterials());
     Field <ListGraphType <MaterialType> >("MeterialByBrandId",
                                           arguments: new QueryArguments
     {
         new QueryArgument <IntGraphType> {
             Name        = "Id",
             Description = "Brand Id"
         }
     },
                                           resolve: ctx => _marketingContext.GetMaterialsByBrandId(ctx.GetArgument <int>("Id")));
     Field <ListGraphType <BrandType> >("Brands", resolve: ctx => _marketingContext.GetBrands());
 }