コード例 #1
0
        public TodosController()
        {
            todoList = new TodoList {
                Todos = new ArrayList()
            };
            todoList.AddTodoItem(new TodoItem {
                Id = 1, Name = "Dick", isComplete = false
            });

            todoList.AddTodoItem(new TodoItem {
                Id = 2, Name = "Matej", isComplete = true
            });
        }
コード例 #2
0
        public IActionResult AddTodo(TodoList e)
        {
            var newTodo    = new TodoItem(e.newTodo.Description);
            var jsonString = HttpContext.Request.Cookies["userinfo"];

            jsonString = TodoList.AddTodoItem(jsonString, newTodo);

            UpdateCookie(jsonString);

            return(RedirectToAction("Index", "Home", new { area = "" }));
        }