I have an MVC application and the UI team has requested that urls for a careers page follow this format: mydomain.com/careers/{jobTitle}/{JobCode}
. I can do that in the careers controller like this:
public ActionResult Detail(string jobTitle, string jobCode)
{
var model = getModelFromDb(JobCode);
return View(model);
}
The problem is that we look up the career info by job code not title so we end up with an unused parameter. I don't think this is best practice. Especially since you can enter whatever you want for the career title and still get the job details back. A url like this would still work: mydomain.com/careers/yourmom/1234.
I suppose we could always look up careers by title and code but that seems kind of pointless since the codes are unique.
Is there a better way to implement the extra parameter in the url and keep from allowing invalid job titles from being put in the url?