Пример #1
0
        public async Task <Pet> GetPet(int petId, int ownerId)
        {
            // Load our specific table
            var petTable = Table.LoadTable(DynamoClient, "Pets");

            // get the owner
            var result = await petTable.GetItemAsync(petId, ownerId);

            //Map results  to response
            return(PetResponseBuilder.Create(result));
        }
Пример #2
0
        public async Task <List <Pet> > GetPets(int ownerId)
        {
            // Load our specific table
            var petTable = Table.LoadTable(DynamoClient, "Pets");

            var scanFilter = new ScanFilter();

            scanFilter.AddCondition("OwnerId", ScanOperator.Equal, ownerId);

            var search = petTable.Scan(scanFilter);

            //todo add pagination
            var documentList = new List <Document>();

            do
            {
                documentList = await search.GetNextSetAsync();
            } while (!search.IsDone);

            //Map results  to response
            return(PetResponseBuilder.CreateList(documentList));
        }