✅ Opinion time: Handling multiple id's in the same path (ASP.NET MVC)
I want to make surveys and survey submissions.
The URL will be something like
/surveys/1/submissions/2
indicating that I'm checking the survey with id 1 that has the submission of id 2. There will be CRUD with Entity Framework for both surveys and submissions.
Is this a good idea to use two different controllers, or can it be done on a single controller?3 Replies
doesnt matter, can be done with either way
its not a problem to have more than one url parameter
thank you, I'll check it out. I'm trying to avoid relying on
TempData
because right now I'm using it as a place that stores the survey Id to carry it over to the other controller
I think I'll keep the 2 controllers separate because it's an issue with naming the CRUD paths, given that they're both within the same area.
So they have paths like AreaName/surveys/1/submissions/create
but I also need an AreaName/surveys/create
, and having them both on the same controller will mess up the pattern recognition system for areas 😭
I'm so new in MVC it hurtsthats fine