async Task AddTableEntityAsync() { var rowKey = Guid.NewGuid(); var entityToSave = new CheeseReviewEntity(this.Email, rowKey); entityToSave.CheeseType = CheeseType; entityToSave.Comments = Comments; entityToSave.DairyName = DairyName; entityToSave.EmailAddress = Email; entityToSave.ReviewDate = DateTime.Now; // First add to Akavache (ideally in Akavache we would also keep track of whether it uploaded successfully or not await BlobCache.LocalMachine.InsertObject <CheeseReviewEntity> ( $"{entityToSave.PartitionKey}|{entityToSave.RowKey}", entityToSave ); // Get the table service var tableService = new CheeseTableService(); bool success = await tableService.SaveReviewAsync(entityToSave); if (success) { // Could display a success or failure message // We should also keep track of whether the entity has been uploaded yet or not for offline access // Pop the modal off the stack await Navigation.PopModalAsync(); } }
private async Task SearchReviewsAsync() { // Search the reviews var tableService = new CheeseTableService(); var searchResults = await tableService.SearchCheeseReviewsAsync(EmailAddress); // Loop through the results and place into Akavache foreach (var item in searchResults) { // Akavache will auto update when a key is matched await BlobCache.LocalMachine.InsertObject<CheeseReviewEntity> ( $"{item.PartitionKey}|{item.RowKey}", item); // Check to see if this is already in the collection if (Reviews.Contains (item)) { Reviews.Remove (item); } Reviews.Add (item); } }
private async Task SearchReviewsAsync() { // Search the reviews var tableService = new CheeseTableService(); var searchResults = await tableService.SearchCheeseReviewsAsync(EmailAddress); // Loop through the results and place into Akavache foreach (var item in searchResults) { // Akavache will auto update when a key is matched await BlobCache.LocalMachine.InsertObject <CheeseReviewEntity> ( $"{item.PartitionKey}|{item.RowKey}", item); // Check to see if this is already in the collection if (Reviews.Contains(item)) { Reviews.Remove(item); } Reviews.Add(item); } }
async Task AddTableEntityAsync () { var rowKey = Guid.NewGuid (); var entityToSave = new CheeseReviewEntity (this.Email, rowKey); entityToSave.CheeseType = CheeseType; entityToSave.Comments = Comments; entityToSave.DairyName = DairyName; entityToSave.EmailAddress = Email; entityToSave.ReviewDate = DateTime.Now; // First add to Akavache (ideally in Akavache we would also keep track of whether it uploaded successfully or not await BlobCache.LocalMachine.InsertObject<CheeseReviewEntity> ( $"{entityToSave.PartitionKey}|{entityToSave.RowKey}", entityToSave ); // Get the table service var tableService = new CheeseTableService (); bool success = await tableService.SaveReviewAsync (entityToSave); if (success) { // Could display a success or failure message // We should also keep track of whether the entity has been uploaded yet or not for offline access // Pop the modal off the stack await Navigation.PopModalAsync (); } }