Skip to content

Resource guide results#483

Merged
JoeProgrammer88 merged 4 commits intomainfrom
ResourceGuideResults
Apr 21, 2026
Merged

Resource guide results#483
JoeProgrammer88 merged 4 commits intomainfrom
ResourceGuideResults

Conversation

@JoeProgrammer88
Copy link
Copy Markdown
Member

Summary

Refactored the Resource Guide page to improve readability and some performance issues

Copilot Summary

This pull request refactors how agency details are rendered in the resource guide and improves the efficiency and maintainability of the code. The main changes include replacing reflection-based rendering with a strongly-typed partial view, simplifying email handling, and optimizing the agency query logic.

Refactoring and UI Improvements:

  • Introduced a new partial view _AgencyDetails.cshtml that explicitly renders each relevant field of an Agency, replacing the previous reflection-based approach in the modal body for better maintainability and clarity. (PC2/Views/Shared/_AgencyDetails.cshtml, PC2/Views/Resources/ResourceGuide.cshtml) [1] [2]
  • Simplified email address rendering in the agency list and detail modal: emails are now split and displayed as individual mailto links using StringSplitOptions.RemoveEmptyEntries for more robust handling of multiple addresses. (PC2/Views/Resources/ResourceGuide.cshtml) [1] [2]

Backend Query Optimization:

  • Optimized the GetSpecificAgenciesAsync method to directly query agencies by category with an efficient LINQ query, removing the need to fetch all agencies and filter them in memory. (PC2/Data/AgencyDB.cs)

Replaces reflection-based agency details rendering in ResourceGuide.cshtml with a new _AgencyDetails.cshtml partial. The partial explicitly renders each Agency field, improving maintainability and clarity, and provides custom formatting for emails, phone numbers, and websites.
Replaced manual iteration with an EF Core LINQ query to fetch agencies by category. Now includes AgencyCategories, orders by AgencyName, and returns results asynchronously for improved performance and readability.
Simplified multiple email handling by splitting the email string and iterating with a foreach loop. Each email is now trimmed and rendered as a mailto link, replacing the previous manual substring logic.
Removed unnecessary variables and loops from the email rendering section. Each email is now rendered directly as a mailto link, improving code clarity and maintainability.
@JoeProgrammer88 JoeProgrammer88 merged commit 4daf578 into main Apr 21, 2026
1 check passed
@JoeProgrammer88 JoeProgrammer88 deleted the ResourceGuideResults branch April 21, 2026 21:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant