예제 #1
0
        public async Task SecurityGroupUsersUpdate(CNDSSecurityGroupUserDTO dto)
        {
            if (await DataContext.Users.AnyAsync(u => dto.UserID == u.ID && u.UserType == DTO.Enums.UserTypes.CNDSNetworkProxy))
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "CNDS Network Proxy Users cannot be assigned to CNDS security groups."));
            }

            Guid networkID = await CNDSEntityUpdater.GetNetworkID(DataContext);

            try
            {
                using (var cnds = new CNDSEntityUpdater(networkID))
                {
                    await CNDSEntityUpdater.UpdateSecurityGroupUsers(dto);
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex.Message, ex);
                throw;
            }
        }