static async System.Threading.Tasks.Task GetInvidualListAndPerformUpdate(TableStorageListService service) { Console.WriteLine("\r\n********* Updating a List *********\r\n"); //Get Individual List Console.WriteLine(""); Console.WriteLine($"Loading inbox list from user 3"); Console.WriteLine(""); var lists = await service.GetAllLists(); var listId = lists.ToList()[0].Id; var list = await service.GetListById(listId); Console.WriteLine($"LOADED {list.Name} with {list.Tasks.Count} tasks ({list.Tasks.Where(x => x.CompletedDate == null).Count()} not completed) {list.Id} for user {service.listRepository.AuthenticatedUser.UserID}"); //Update List list.Name = "Inbox-NewName"; list.Tasks.Add(new AzureLists.Library.Task() { Title = "New-Task" }); list = await service.CreateOrUpdateList(list); Console.WriteLine($"UPDATED {list.Name} with {list.Tasks.Count} tasks ({list.Tasks.Where(x => x.CompletedDate == null).Count()} not completed) {list.Id} for user {service.listRepository.AuthenticatedUser.UserID}"); //Re-Read Updated List list = await service.GetListById(listId); Console.WriteLine($"RE-LOADED {list.Name} with {list.Tasks.Count} tasks ({list.Tasks.Where(x => x.CompletedDate == null).Count()} not completed) {list.Id} for user {service.listRepository.AuthenticatedUser.UserID}"); }
static async System.Threading.Tasks.Task DeleteTask(TableStorageListService service) { Console.WriteLine("\r\n********* Deleting a Task *********\r\n"); var lists = await service.GetAllLists(); var list = lists.ToList()[0]; Console.WriteLine($"List {list.Name} has {list.Tasks.Count} tasks for user {service.listRepository.AuthenticatedUser.UserID}"); //Delete Individual Task Console.WriteLine("Deleting a task"); await service.DeleteTask(list.Tasks[0].Id); list = await service.GetListById(list.Id); Console.WriteLine($"List {list.Name} has {list.Tasks.Count} tasks for user {service.listRepository.AuthenticatedUser.UserID}"); Console.WriteLine(""); }