Beispiel #1
0
        public ActionResult Get(string id)
        {
            var car = db.FindCar(id);

            if (car == default)
            {
                return(NotFound("Sorry - we couldn't find that car in our database!"));
            }
            var json = new {
                links = new {
                    carModel = new {
                        href = car.CarModel.Uri
                    }
                },
                item = car
            };

            return(Ok(json));
        }
Beispiel #2
0
        private Car GetCar(IResolveFieldContext <object> context)
        {
            var registration = context.Arguments["registration"].GetPropertyValue <string>();

            return(db.FindCar(registration));
        }