Пример #1
0
        private int AssignStudentsToSynthesis(IEnumerable <Guid> studentIds, int testId)
        {
            if (_synthesisRepo.Get(testId).Status >= TestStatus.Completed)
            {
                return(0);
            }

            var synthesisEntity = _synthesisRepo.GetWithTaskAndTemplate(testId);
            var userMapEntities = _userRepo.Get(studentIds);

            var createContainedUserSuccessIds = new List <Guid>();

            #region Create_Contained_Users
            var task     = synthesisEntity.Task;
            var template = task.Template;
            foreach (var userMapEntity in userMapEntities)
            {
                if (CreateContainedReadonly(userMapEntity.SqlUsername, userMapEntity.SqlPassword, template.NameOnServer))
                {
                    createContainedUserSuccessIds.Add(userMapEntity.AzureId);
                }
            }
            #endregion

            return(_studentRepo.AssignSynthesisTest(createContainedUserSuccessIds, testId, UserId));
        }