Civic Action - Adding Project Filters
A little update on what I’ve been working on for the Civic Action site!
I worked on adding a dropdown menu to the Projects page so admins can filter projects by workshop. I wanted the workshop options to come directly from the database instead of having to type them in manually, so I used IsWorkshop to find workshop records and Distinct() to avoid duplicate titles. This way, when new workshops are added to the database, they can automatically show up as options in the dropdown.
I updated the Projects page logic in Index.cshtml.cs to load the workshop titles and filter the results based on the selected option. I also worked on displaying student names alongside their project details so admins can see who each project belongs to. This involved using Entity Framework to retrieve the related student information from the database.
One thing I had to pay attention to was making sure students could still only see their own projects. The original code already filtered projects using the logged-in user's ID, so I needed to keep that behavior while adding the new admin filtering. It helped me understand how important it is to consider different user roles when changing how information is displayed.
While working on this, I also learned more about how Razor Pages connects the frontend and backend. The .cshtml file controls what the user sees, including the dropdown, while the .cshtml.cs file handles retrieving the data and applying the filters. Seeing how the two files work together made the structure of the project a little clearer to me.
I’m still working through some issues like adding images and applying the filtering to edit/delete/detail file. I’m starting to get a better understanding of how the different parts of the site fit together.
About the author
- I am a Computer Science and Mathematics double major at Hendrix College with hands-on experience building practical software solutions. Currently a Software Developer at Disco Tray Studios, my background includes client experience work at Apptegy and technical support as a Hendrix HelpDesk Assistant. Outside of tech, I am a flag football athlete and enjoy painting.
Comments
Join the discussionNo comments yet. Be the first to comment.
