public ActionResult Index(TodoItem item)
 {
     if (ModelState.IsValid)
     {
         _todoList.Add(item);
         Response.StatusCode = (int) HttpStatusCode.Created;
         return RedirectToAction("Index");
     }
     return View();
 }
        public ActionResult Index(int id, TodoItem item)
        {
            var removed = _todoList.Items.SingleOrDefault(i => i.Id == id);
            if (removed == null)
                return new HttpNotFoundResult();

            if (!ModelState.IsValid)
                return new HttpStatusCodeResult((int) HttpStatusCode.BadRequest);

            _todoList.Items.Remove(removed);
            _todoList.Add(item);
            return RedirectToAction("Index", "Todo");
        }
 public void Remove(TodoItem item)
 {
     _todoItems.Remove(item);
 }
 public void Add(TodoItem item)
 {
     _todoItems.Add(item);
 }