Ejemplo n.º 1
0
        public async Task <Owner> CreateOwner(Owner owner)
        {
            // Load our specific table
            var ownerTable = Table.LoadTable(DynamoClient, "Owners");

            // Set out uniq Id
            owner.OwnerId = new Random().Next(0, 1000000);

            // create the request to create the owner
            var queryRequest = OwnerRequestBuilder.Create(owner);

            // Save the changes
            await ownerTable.PutItemAsync(queryRequest);

            return(owner);
        }
Ejemplo n.º 2
0
        public async Task <Owner> UpdateOwner(Owner owner)
        {
            // Load our specific table
            var ownerTable = Table.LoadTable(DynamoClient, "Owners");

            // Get the stored owner
            var foundOwner = await GetOwner(owner.OwnerId);

            if (foundOwner == null)
            {
                return(null);
            }

            // update the request to create the owner
            var queryRequest = OwnerRequestBuilder.Create(owner);

            await ownerTable.UpdateItemAsync(queryRequest);

            return(owner);
        }