Exemple #1
0
 protected override BusDetailsResponse Resolve(ResolveFieldContext context)
 {
     if (context.HasArgument(ApiConstants.GraphqlArgumentNames.PATH))
     {
         var value = context.Arguments[ApiConstants.GraphqlArgumentNames.PATH];
         if (value != null && value == "Scrap")
         {
             return(new BusDetailsResponse(true)
             {
                 Result = false
             });
         }
     }
     return(new BusDetailsResponse(true)
     {
         Model = "Suzuki",
         Passengers = 50,
         Result = true
     });
 }
Exemple #2
0
            protected override CarDetailsResponse Resolve(ResolveFieldContext context)
            {
                CarDetailsResponse response = null;

                if (context.HasArgument(ApiConstants.GraphqlArgumentNames.PATH))
                {
                    var value = context.Arguments[ApiConstants.GraphqlArgumentNames.PATH];
                    if (value != null && value == "Blue")
                    {
                        response = new CarDetailsResponse(true)
                        {
                            HousedAddress = new Address()
                            {
                                AddressLineOne = "Blue HousedAddress",
                                Postcode       = "4000",
                                State          = "QLD",
                                Suburb         = "Brisbane"
                            }
                        };
                    }
                }
                response = new CarDetailsResponse(true)
                {
                    HousedAddress = new Address()
                    {
                        AddressLineOne = "Unknown HousedAddress",
                        Postcode       = "2000",
                        State          = "NSW",
                        Suburb         = "Sydney"
                    }
                };

                response.Make     = "Toyota";
                response.Model    = "Tarago";
                response.HasAlarm = true;

                return(response);
            }