Esempio n. 1
0
        /// <inheritdoc />
        public async Task DefineCampusLead(ClaimsPrincipal user, Guid campusId, Guid newLeadId)
        {
            var campus = await _campusDbService.GetById(campusId);

            await _graphGroupService.ChangeGroupOwner(campus.AadGroupId, newLeadId);

            campus.Lead       = newLeadId;
            campus.ModifiedBy = AuthenticationHelper.GetUserIdFromToken(user);

            await _campusDbService.Update(campus);

            // change managers
            await _graphUserService.DefineCampusLead(newLeadId, campus.Id);
        }
Esempio n. 2
0
        /// <inheritdoc />
        public async Task <Hub> ChangeHubLead(Guid userId, Guid id, Guid newLead)
        {
            var hub = await _hubDbService.GetById(id);

            await _graphGroupService.ChangeGroupOwner(hub.AadGroupId, newLead);

            hub.Lead       = newLead;
            hub.ModifiedBy = userId;

            await _hubDbService.Update(hub);

            // change managers
            var campusLeads = hub.Campus.Select(c => c.Lead);
            await _graphUserService.DefineHubLead(newLead, campusLeads, hub.Id);

            return(Hub.FromDb(hub));
        }