Exemple #1
0
        public ActionResult Create([Bind(Include = "userID,name,description,deadlineTime,isPublic")] TodoTask todoTask)
        {
            todoTask.CreationTime = DateTime.Now;
            todoTask.StatusID     = TodoList.Models.Status.NEEDS_DONE;

            if (ModelState.IsValid)
            {
                db.TodoTasks.Add(todoTask);
                db.SaveChanges();

                // send them back to the last page they were looking at
                string redirectAction = (Session["LastAction"] == null) ? "List" : (Session["LastAction"] as string);
                return(RedirectToAction(redirectAction, "Home"));
            }

            return(View());
        }