Пример #1
0
        // GET: ToDoListController/Create
        public ActionResult Create(int id)
        {
            var _tmpUser = _userRepository.GetUserDetails(id);

            if (_tmpUser != null)
            {
                ToDoList tmp_toDoList = _toDoListRepository.Add(
                    new ToDoList
                {
                    ToDoListName            = _tmpUser.UserName + "'s To Do List",
                    UserIDCreator           = _config["LogedUser"],
                    IDCreator               = Convert.ToInt32(_config["LogedUserID"].ToString()),
                    UserIDExecutor          = _tmpUser.UserName,
                    IDExecutor              = _tmpUser.UserID,
                    CreatedToDoListDatetime = DateTime.Now,
                    FinalizationDatetime    = DateTime.Now.AddDays(1)
                }
                    );

                IEnumerable <ToDoTask>            tasks = _taskRepository.ActiveTasks();
                IEnumerable <AddTask_To_ToDoList> c     = _toDoListRepository.AddTasksToList(tasks.ToList(), tmp_toDoList);
                IEnumerable <AddTask_To_ToDoList> model = _toDoListRepository.GetToDoListById(tmp_toDoList.ToDoListID);
                ViewBag.ListName   = tmp_toDoList.ToDoListName;
                ViewBag.AssignedTo = tmp_toDoList.UserIDExecutor;
                ViewBag.AssignedBy = tmp_toDoList.UserIDCreator;
                c = _toDoListRepository.GetListByAssignedUserId(tmp_toDoList.IDExecutor);
                return(View("~/Views/ToDoList/ShowActiveListWithToDoTasks.cshtml", c));
            }
            return(View("Index"));
        }