public static TaskViewModel Create(Business.Models.Task task) { if (task == null) { return(null); } return(new TaskViewModel(task)); }
private async Task <bool> AddTaskAsync(Business.Models.Task task) { if (await _accessCheckService.IsOwnerAsync(task.TeamId)) { return(await _manageTasksService.AddTaskAsync(task)); } else { return(false); } }
private TaskViewModel(Business.Models.Task task) { TeamMember = task.MemberId != null?TeamMemberViewModel.Create(task.TeamMember) : null; TeamId = task.TeamId; Name = task.Name; SprintId = task.SprintId; MemberId = task.MemberId; StoryPoints = task.StoryPoints; Id = task.Id; Link = task.Link; Completed = task.Completed; }
private TaskFormViewModel(Business.Models.Task task, string taskMemberName, string errorMessage, List <TeamMemberViewModel> teamMemberViewModels) { TeamId = task.TeamId; TaskId = task.Id; TaskSprintId = task.SprintId.GetValueOrDefault(); TeamName = task.Team.TeamName; TaskName = task.Name; TaskLink = task.Link; TaskStoryPoints = task.StoryPoints; TaskMemberId = task.MemberId; ErrorMessage = errorMessage; TaskMemberName = taskMemberName; TeamMembers = teamMemberViewModels; }
public static TaskFormViewModel Create(Business.Models.Task task, string errorMessage, List <Business.Models.TeamMember> teamMembers, List <Business.Models.Sprint> sprints) { var teamMember = teamMembers.FirstOrDefault(t => t.Id == task.MemberId); var teamMemberViewModels = new List <TeamMemberViewModel>(); string taskMemberName; if (teamMember != null) { taskMemberName = teamMember.Member.UserName; } else { taskMemberName = ""; } foreach (var member in teamMembers) { if (member != null) { var teamMemberViewModel = TeamMemberViewModel.Create(member); teamMemberViewModels.Add(teamMemberViewModel); } } var sprintViewModels = new List <SprintViewModel>(); foreach (var sprint in sprints) { var sprintViewModel = SprintViewModel.Create(sprint, false, 0); sprintViewModels.Add(sprintViewModel); } return(new TaskFormViewModel(task, taskMemberName, errorMessage, teamMemberViewModels)); }