コード例 #1
0
        private async void MapApplicableRights(Asset newAsset, IInformationAsset message)
        {
            if (message.ApplicableRights != null && message.ApplicableRights.Count > 0)
            {
                var appRightsRepo = _unitOfWork.GetRepository <ApplicableRight>();
                var allRights     = await appRightsRepo.GetAll();


                var selected = allRights.Where(item => message.ApplicableRights.Any(x => x.Key == item.ApplicableRightId));
                newAsset.ApplicableRights = new List <AssetApplicableRight>();

                foreach (var item in selected)
                {
                    newAsset.AddApplicableRight(item);
                }
            }
        }