Esempio n. 1
0
        public void EditToDoList()
        {
            _writer.WriteLine("Enter Id of ToDoList for Edit");
            string input = Console.ReadLine();
            int    listId;

            if (int.TryParse(input, out listId) && _toDoListService.ToDoListWithIdExists(listId) &&
                _toDoListService.CanEditList(listId, _userService.CurrentUser.Id))
            {
                ToDoList tdl = _toDoListService.GetToDoListById(listId);
                DisplayListData(tdl);
                _writer.WriteLine("Enter List Title:");
                string title  = _reader.ReadLine();
                bool   edited = _toDoListService.EditToDoList(listId, title, _userService.CurrentUser.Id);
                if (edited)
                {
                    _writer.WriteLine($"ToDoList with id {listId} edited");
                }
                else
                {
                    _writer.WriteLine("Edit FAIL");
                }
            }
            else
            {
                _writer.WriteLine("Invalid id");
            }
            _writer.WriteLine("");
        }
Esempio n. 2
0
        private static void EditToDoList()
        {
            Console.WriteLine("Enter Id of ToDoList for Edit");
            string input = Console.ReadLine();
            int    listId;

            if (int.TryParse(input, out listId) && _toDoListService.ToDoListWithIdExists(listId) &&
                _toDoListService.CanEditList(listId, _userService.CurrentUser.Id))
            {
                _toDoListService.DisplayListData(listId);
                Console.WriteLine("Enter List Title:");
                string title  = Console.ReadLine();
                bool   edited = _toDoListService.EditToDoList(listId, title, _userService.CurrentUser.Id);
                if (edited)
                {
                    Console.WriteLine($"ToDoList with id {listId} edited");
                }
                else
                {
                    Console.WriteLine("Edit FAIL");
                }
            }
            else
            {
                Console.WriteLine("Invalid id");
            }
            Console.WriteLine();
        }