Пример #1
0
        public async Task UpdateStatusAsync(int userId, int taskId, TaskStatus status)
        {
            if (!await _projectsDataAccessor.IsProjectCreatorByTaskId(userId, taskId) &&
                !await _permissionsDataAccessor.HasPermissionForTask(userId, taskId))
            {
                throw new NoPermissionsForOperationException(ErrorMessages.NoPermissionsForOperation);
            }

            var task = await _taskDataAccessor.UpdateStatusAsync(taskId, status);

            using (_connectionContext.EventScope())
            {
                _taskEventAccessor.StatusUpdated(task, await _projectsDataAccessor.GetAsync(taskId));
            }
        }
Пример #2
0
        public async Task UpdatePermissionsForUserAsync(int userId, IProjectPermission[] permissions)
        {
            await _permissionsDataAccessor.UpdatePermissionsForUserAsync(userId, permissions);

            using (_connectionContext.EventScope())
            {
                _permissionsEventAccessor.PermissionsUpdated(userId, permissions);
            }
        }
Пример #3
0
        private void ExecuteScope(ScopeType type, bool isInTransactionScope)
        {
            if (type == ScopeType.Event)
            {
                _connectionContext.EventScope();
                return;
            }

            if (isInTransactionScope)
            {
                _connectionContext.TransactionScope();
            }
            else
            {
                _connectionContext.Scope();
            }
        }