public async Task <IActionResult> Create(string projectId, TaskCreateViewModel newTaskVM) { int projId = _project.UnprotectProjectId(projectId); newTaskVM.Task.MemberId = _member.GetMemberId(User); newTaskVM.Task.ProjectId = projId; Task newTask = await _task.AddAsync(newTaskVM.Task); Project project = await _project.GetProjectByIdAsync(projId); await _project.UpdateAsync(project); return(RedirectToAction("Index", new { projectId = projectId })); }
public async Task <IActionResult> Index() { TaskViewModel taskVM = new TaskViewModel(); List <TaskMember> taskMembers = new List <TaskMember>(); string memberId = _member.GetMemberId(User); taskMembers = await _taskMember.GetByMemberIdAsync(memberId); foreach (TaskMember taskMember in taskMembers) { Task task = await _task.GetTaskAsync(taskMember.TaskId); taskVM.Tasks.Add(task); } return(View("IndividualTasks", taskVM)); }