Exemple #1
0
        static async System.Threading.Tasks.Task GetInvidualTaskAndPerformUpdate(TableStorageListService service)
        {
            Console.WriteLine("\r\n********* Updateing a Task *********\r\n");
            var lists = await service.GetAllLists();

            //Get Individual Task
            var taskId = lists.ToList()[0].Tasks[0].Id;
            var task   = await service.GetTaskById(taskId);

            Console.WriteLine($"LOADED task - {task.Title} (Important: {task.Important}) for user {service.listRepository.AuthenticatedUser.UserID}");

            //Update Task
            task.Title    += " and another thing";
            task.Important = !task.Important;
            task           = await service.ReplaceTask(task);

            Console.WriteLine($"UPDATED task - {task.Title} (Important: {task.Important}) for user {service.listRepository.AuthenticatedUser.UserID}");

            //Re-Read Updated List
            task = await service.GetTaskById(taskId);

            Console.WriteLine($"RE-LOADED task - {task.Title} (Important: {task.Important}) for user {service.listRepository.AuthenticatedUser.UserID}");

            Console.WriteLine("");
        }
Exemple #2
0
        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}");
        }
Exemple #3
0
        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("");
        }