Ejemplo n.º 1
0
        /// <summary>
        /// Loads the tasks for a given user in to main page.
        /// </summary>
        /// <returns>The dashboard of the user.</returns>
        public ActionResult UserDashBoard()
        {
            if (Session["UserID"] != null)
            {
                int userId = Convert.ToInt32(Session["UserID"]);

                ToDoTasksFacade   facade = new ToDoTasksFacade(resporitoryToDoTasks);
                List <UIToDoTask> tasks  = facade.GetAllTasksForUser(userId);

                return(View(tasks));
            }
            else
            {
                return(RedirectToAction("Login"));
            }
        }
Ejemplo n.º 2
0
        public ActionResult CreateNewUser(UIToDoTask task)
        {
            ToDoTasksFacade facade = new ToDoTasksFacade(resporitoryToDoTasks);

            task.TaskUserId  = Convert.ToInt32(Session["UserID"]);
            task.LastUpdated = System.DateTime.Now;

            facade.Save(task);
            if (Session["UserID"] != null)
            {
                int userId = Convert.ToInt32(Session["UserID"]);
                facade = new ToDoTasksFacade(resporitoryToDoTasks);
                List <UIToDoTask> tasks = facade.GetAllTasksForUser(userId);
                return(View("UserDashBoard", tasks));
            }
            else
            {
                return(RedirectToAction("Login"));
            }
        }