public async Task <IActionResult> PostPlace([FromBody] CrowdsourcedPlace place)
        {
            if (place == null)
            {
                return(new BadRequestObjectResult(ModelState));
            }

            await _crowdsourcedPlacesService.CreateCrowdsourcedPoint(place);

            return(Ok());
        }
        public async Task CreateCrowdsourcedPoint(CrowdsourcedPlace place)
        {
            place.PlaceId      = Guid.NewGuid();
            place.CreationTime = DateTime.UtcNow;

            var status = await _bucket.InsertAsync(place.PlaceId.ToString(), place).ConfigureAwait(false);

            if (!status.Success)
            {
                throw new ApplicationException(status.Message, status.Exception);
            }
        }
        public static void Main(string[] args)
        {
            var config = new ClientConfiguration
            {
                Servers = new List <Uri> {
                    new Uri("http://104.236.220.12:8091/pools")
                },
                BucketConfigs = new Dictionary <string, BucketConfiguration>
                {
                    ["geodb"] = new BucketConfiguration
                    {
                        BucketName = "geodb",
                        Password   = "******",
                    }
                }
            };

            var testDoc = new CrowdsourcedPlace
            {
                CreationTime          = DateTime.UtcNow,
                CreatorId             = Guid.NewGuid(),
                CrowdsourcedPlaceType = CrowdsourcedPlaceType.Pasture,
                Description           = "desc",
                Point   = new Point(new GeographicPosition(0.1d, 0.2d)),
                PlaceId = Guid.NewGuid()
            };

            using (var cluster = new Cluster(config))
                using (var bucket = cluster.OpenBucket("geodb"))
                {
                    var res = bucket.InsertAsync(new Document <CrowdsourcedPlace>()
                    {
                        Content = testDoc, Id = testDoc.PlaceId.ToString()
                    }).Result;
                }
        }