Пример #1
0
 public static TaskViewModel Create(Business.Models.Task task)
 {
     if (task == null)
     {
         return(null);
     }
     return(new TaskViewModel(task));
 }
Пример #2
0
 private async Task <bool> AddTaskAsync(Business.Models.Task task)
 {
     if (await _accessCheckService.IsOwnerAsync(task.TeamId))
     {
         return(await _manageTasksService.AddTaskAsync(task));
     }
     else
     {
         return(false);
     }
 }
Пример #3
0
        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;
        }
Пример #4
0
 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;
 }
Пример #5
0
        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));
        }