Exemple #1
0
        public async Task ModifyTask(TaskModificationModel modificationModel, USER user)
        {
            TEAM team = _teamRepository.GetTeamById(modificationModel.TeamId);
            TASK task = _taskRepository.GetTaskById(modificationModel.TaskId);

            if (task != null && team != null)
            {
                if (_permissionService.CheckPermissionToCreateTasks(user, team.ID))
                {
                    task.TITLE       = modificationModel.Title;
                    task.DESCRIPTION = modificationModel.Description;
                    task.DEATHLINE   = modificationModel.Deathline;
                    task.START_TIME  = modificationModel.StartTime;
                    task.END_TIME    = modificationModel.EndTime;
                    task.USER        = String.IsNullOrEmpty(modificationModel.AssignedToId) ? null : await _userRepository.GetUserById(modificationModel.AssignedToId);

                    task.TASK_STATUS = _taskRepository.GetTaskStatusById(modificationModel.StatusId);
                }
                else
                {
                    if (_permissionService.CheckPermissionToAssignTasks(user, team.ID))
                    {
                        task.USER = String.IsNullOrEmpty(modificationModel.AssignedToId) ? null : await _userRepository.GetUserById(modificationModel.AssignedToId);
                    }
                    if (task.USER == user)
                    {
                        task.TASK_STATUS = _taskRepository.GetTaskStatusById(modificationModel.StatusId);
                    }
                }

                _taskRepository.UpdateTasks(new List <TASK> {
                    task
                });
            }
        }
Exemple #2
0
        public async Task SaveTask(TaskModificationModel modificationModel)
        {
            USER user = await _userRepository.GetUserByContext(HttpContext.User);

            if (_teamRepository.IsTeamMember(user, modificationModel.TeamId))
            {
                await _taskService.ModifyTask(modificationModel, user);
            }
        }
Exemple #3
0
        public async Task DeleteTask(TaskModificationModel modificationModel)
        {
            USER user = await _userRepository.GetUserByContext(HttpContext.User);

            if (_permissionService.CheckPermissionToCreateTasks(user, modificationModel.TeamId))
            {
                _taskService.DeleteTask(modificationModel.TaskId, modificationModel.TeamId);
            }
        }