Exemplo n.º 1
0
        public ActionResult PromoteTodo(Context context)
        {
            var doing = context.GetDoing();
            var selected = context.GetSelected();
            if (doing == selected)
            {
                context.List.Remove(selected);
            }else if (doing == null)
            {
                selected.Promote();
                selected.Updated = DateTime.Now;
            }

            context.SaveChanges();
            return RedirectToAction("Todos", "Home");
        }
Exemplo n.º 2
0
        public ActionResult CreateTodo(TodoItem model)
        {
            var context = new Context();
            if(ModelState.IsValid && (model.Content != null))
            {
                try
                {
                    context.List.Add(model);
                    context.SaveChanges();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.StackTrace);
                }
            }

            return RedirectToAction("Todos", "Home");
        }
Exemplo n.º 3
0
 public ActionResult Todos()
 {
     var context = new Context();
     return View(context);
 }