Ejemplo n.º 1
0
        public ICommandResult Add(CommandContext context)
        {
            List <TodoItem> newItems = new List <TodoItem>();

            foreach (string todoItem in context.GetParameterValues("todo"))
            {
                newItems.Add(service.Add(todoItem));
            }

            return(ShowQuery.BuildMarkdownTaskListResult(newItems));
        }
Ejemplo n.º 2
0
        public ICommandResult Toggle(CommandContext context)
        {
            List <TodoItem> toggledItems = new List <TodoItem>();

            foreach (string indexValue in context.GetParameterValues("index"))
            {
                if (!int.TryParse(indexValue, out int index))
                {
                    continue;
                }

                TodoItem item = service.Toggle(index);

                if (item == null)
                {
                    continue;
                }

                toggledItems.Add(item);
            }

            return(ShowQuery.BuildMarkdownTaskListResult(toggledItems));
        }