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); }
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); }
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); }