private BuddyModel Map(Dictionary <string, AttributeValue> result)
        {
            var job = new BuddyModel
            {
                Id           = result["Id"].S,
                FirstName    = result["FirstName"].S,
                LastName     = result["LastName"].S,
                Location     = result["Location"].S,
                Lat          = result["Lat"].S,
                Long         = result["Long"].S,
                MobileNumber = result["MobileNumber"].S,
                Rating       = result["Rating"].S,
                Profile      = result["Profile"].S,
                ImageUrl     = result["ImageUrl"].S
            };

            return(job);
        }
        public async Task CreateUser(BuddyModel model)
        {
            var putItemRequest = new PutItemRequest
            {
                TableName = _tableName,
                Item      = new Dictionary <string, AttributeValue>
                {
                    ["Id"] = new AttributeValue {
                        S = Guid.NewGuid().ToString()
                    },
                    ["FirstName"] = new AttributeValue {
                        S = model.FirstName
                    },
                    ["LastName"] = new AttributeValue {
                        S = model.LastName
                    },
                    ["Location"] = new AttributeValue {
                        S = model.Location
                    },
                    ["Lat"] = new AttributeValue {
                        S = model.Lat
                    },
                    ["Long"] = new AttributeValue {
                        S = model.Long
                    },
                    ["MobileNumber"] = new AttributeValue {
                        S = model.MobileNumber
                    },
                    ["Rating"] = new AttributeValue {
                        S = model.Rating
                    },
                    ["Profile"] = new AttributeValue {
                        S = model.Profile
                    },
                    ["ImageUrl"] = new AttributeValue {
                        S = model.ImageUrl
                    }
                }
            };

            await _dynamoDbClient.PutItemAsync(putItemRequest);
        }
Beispiel #3
0
 private static bool HasNotAcceptedAlready(JobsModel requestorJobByIdMatch, BuddyModel buddy)
 {
     return(requestorJobByIdMatch.BuddiesAccepted == null ||
            !requestorJobByIdMatch.BuddiesAccepted.Contains(buddy.Id));
 }