예제 #1
0
        protected virtual async Task CreateProjectAuditGroupAsync(CreateOrUpdateProjectAuditGroupInput input)
        {
            var projectAuditGroup = new ProjectAuditGroup()
            {
                Name        = input.Name,
                Description = input.Description
                              //Sort_id = input.Sort_id
            };
            var groupId = await _projectAuditGroupRepository.InsertAndGetIdAsync(projectAuditGroup);

            input.Users.ForEach(r =>
            {
                var entity      = new ProjectAuditGroupUser();
                entity.Id       = Guid.NewGuid();
                entity.GroupId  = groupId;
                entity.UserId   = r.UserId;
                entity.UserRole = r.UserRole;
                _projectAuditGroupUserRepository.InsertAsync(entity);
            });

            var adduserid = input.Users.First(x => x.UserRole == 1).UserId;

            await UpdateRole(adduserid, 1, groupId);

            await CurrentUnitOfWork.SaveChangesAsync(); //It's done to get Id of the edition.
        }
예제 #2
0
        protected virtual async Task <Guid> CreateProjectAuditGroup(CreateOrUpdateProjectAuditGroupInput input)
        {
            var projectAuditGroup = new ProjectAuditGroup()
            {
                Name        = input.Name,
                Description = input.Description,
            };
            var retid = await _projectAuditGroupRepository.InsertAndGetIdAsync(projectAuditGroup);

            input.Users.ForEach(r =>
            {
                var entity      = new ProjectAuditGroupUser();
                entity.Id       = Guid.NewGuid(); entity.GroupId = retid;
                entity.UserId   = r.UserId;
                entity.UserRole = r.UserRole;
                _projectAuditGroupUserRepository.InsertAsync(entity);
            });
            await CurrentUnitOfWork.SaveChangesAsync();

            return(retid);
        }