Пример #1
0
        public UploadDocumentsRequest GetObjectToUploadToAws(PinDto pin)
        {
            AwsConnectDto awsPinObject = Mapper.Map <AwsConnectDto>(pin);

            if (pin.PinType == PinType.GATHERING)
            {
                awsPinObject.AddressId = pin.Gathering.Address.AddressID;
                awsPinObject.Latitude  = pin.Gathering.Address.Latitude;
                awsPinObject.Longitude = pin.Gathering.Address.Longitude;
                awsPinObject.City      = pin.Gathering.Address.City;
                awsPinObject.LatLong   = (pin.Gathering.Address.Latitude == null || pin.Gathering.Address.Longitude == null)
                    ? "0 , 0" : $"{pin.Gathering.Address.Latitude} , {pin.Gathering.Address.Longitude}";
                awsPinObject.State            = pin.Gathering.Address.State;
                awsPinObject.Zip              = pin.Gathering.Address.PostalCode;
                awsPinObject.GroupStartDate   = pin.Gathering.StartDate;
                awsPinObject.GroupId          = pin.Gathering.GroupId;
                awsPinObject.GroupTypeId      = pin.Gathering.GroupTypeId;
                awsPinObject.GroupDescription = pin.Gathering.GroupDescription;
                awsPinObject.GroupName        = pin.Gathering.GroupName;
            }

            AwsCloudsearchDto awsPostPinObject = new AwsCloudsearchDto("add", GenerateAwsPinId(pin), awsPinObject);

            var pinlist = new List <AwsCloudsearchDto> {
                awsPostPinObject
            };

            string jsonAwsObject = JsonConvert.SerializeObject(pinlist, new JsonSerializerSettings {
                NullValueHandling = NullValueHandling.Ignore
            });

            MemoryStream jsonAwsPinDtoStream = new MemoryStream(Encoding.UTF8.GetBytes(jsonAwsObject));

            UploadDocumentsRequest upload = new UploadDocumentsRequest()
            {
                ContentType = ContentType.ApplicationJson,
                Documents   = jsonAwsPinDtoStream
            };

            return(upload);
        }
Пример #2
0
 public AwsCloudsearchDto(string type, string id, AwsConnectDto fields)
 {
     this.type   = type;
     this.id     = id;
     this.fields = fields;
 }