コード例 #1
0
        public ExtendedAliasRecord Get(int aliasRecordId)
        {
            var record = _repository.Get(x => x.AliasRecord.Id == aliasRecordId);

            if (record == null)
            {
                var aliasRecord = _aliasRepository.Get(aliasRecordId);
                if (!IsSatisfiedPath(aliasRecord.Path))
                {
                    throw new ApplicationException("Alias is not supported");
                }

                record = new ExtendedAliasRecord
                {
                    AliasRecord = aliasRecord
                };
            }
            return(record);
        }
コード例 #2
0
        public IEnumerable <ExtendedAliasRecord> GetAll()
        {
            var aliasRecords = _aliasRepository.Fetch(_predicate).ToList();
            var records      = new List <ExtendedAliasRecord>();

            foreach (var aliasRecord in aliasRecords)
            {
                var record = _repository.Get(x => x.AliasRecord.Id == aliasRecord.Id);
                if (record == null)
                {
                    record = new ExtendedAliasRecord
                    {
                        AliasRecord = aliasRecord
                    };
                }
                records.Add(record);
            }
            return(records);
        }
コード例 #3
0
        public void Update(int aliasRecordId, string routeName)
        {
            var record = _repository.Get(x => x.AliasRecord.Id == aliasRecordId);

            if (record == null)
            {
                var aliasRecord = _aliasRepository.Get(aliasRecordId);
                if (!IsSatisfiedPath(aliasRecord.Path))
                {
                    throw new ApplicationException("Alias is not supported");
                }

                record = new ExtendedAliasRecord
                {
                    AliasRecord = aliasRecord,
                    RouteName   = routeName
                };
                _repository.Create(record);
                return;
            }

            record.RouteName = routeName;
            _repository.Update(record);
        }