示例#1
0
        async public Task AddPoi(Poi poi)
        {
            await GraphClient.ConnectAsync();

            try
            {
                var resp = await GraphClient.Cypher
                           .Create("(poi:Poi $poi)")
                           .WithParam("poi", poi)
                           .Return(poi => poi.As <Poi>())
                           .ResultsAsync;
            }
            catch (ClientException ce)
            {
                if (ce.Message.Contains("already exists", StringComparison.InvariantCultureIgnoreCase))
                {
                    throw new TravelPlannerException(409, "Poi already exists");
                }
                else
                {
                    throw ce;
                }
            }
        }