Beispiel #1
0
        public IActionResult AddTask(AddTaskViewModel model)
        {
            List <SubTask> subtasks = new List <SubTask>();

            foreach (var subtask in model.SubTasks)
            {
                subtasks.Add(new SubTask()
                {
                    Title       = subtask.Title,
                    Description = subtask.Description,
                    Status      = subtask.Status
                });
            }
            ToDoTask todo = new ToDoTask()
            {
                Title       = model.Title,
                Description = model.Description,
                Priority    = model.Priority,
                Status      = model.Status,
                TaskType    = model.TypeOfTask,
                SubTasks    = subtasks
            };

            _taskService.AddNewTask(todo);

            return(View("_AddedTask"));
        }