I have the following wheel in an asp.net mvc control:
[Route("video/categoria/{categoria}/{page?}/{sort?}")]
The three parameters are: categoria
, filters the category of the video, page?
is the result pagination, sort?
is the query by, most viewed or new.
First situation: First page of a category
\video\categoria\comedia
or
\video\categoria\comedia
Second situation: second page of a category
\video\categoria\comedia
Let's get the 3 cases and place the order, and include the order parameter, that's where I had my first problem.
\video\categoria\comedia\mais_vistos (Erro...)
\video\categoria\comedia\mais_vistos
\video\categoria\comedia\mais_vistos
I fully understand that the error comes at the time it tries to put "more_views" inside the control's page variable.
My solution was to put everywhere you have the link with order \ 1 \ page before. I think it's the right thing to do. \ video \ category \ comedy \ 1 \ more_views
Now I have another problem, one more parameter appeared at the end of the URL:
[Route("video/tag/{tag}/{page?}/{sort?}/{genero?}")]
This parameter will work as optional and can be (empty = all, adult, nonadditional)
Starting from the principle that I gave the solution to put \ 1 \ of page whenever I want to use the order parameter, I happen to have the following cases:
\video\categoria\comedia
\video\categoria\comedia
\video\categoria\comedia
\video\categoria\comedia\mais_vistos
\video\categoria\comedia\mais_vistos
I'm thinking of applying the same solution, only now in both the page parameter and the sort parameter (the default is more_looked):
\video\categoria\comedia
\video\categoria\comedia\mais_vistos\adulto
\video\categoria\comedia
\video\categoria\comedia\mais_vistos\adulto
\video\categoria\comedia
\video\categoria\comedia\mais_vistos\adulto
\video\categoria\comedia\mais_vistos
\video\categoria\comedia\mais_vistos\adulto
\video\categoria\comedia\mais_vistos
\video\categoria\comedia\mais_vistos\adulto
Would that be the best solution anyway?
I would like opinions even if you agree with the solution, leave at least one comment saying that you think the best suggestion.
The whole experience of you is welcome.
UPDATE
The route refers to this method:
public async Task<ActionResult> ConsultaVideo(string categoria, int? page, string sort)
Now it should look like this:
public async Task<ActionResult> ConsultaVideo(string categoria, int? page, string sort, string genero)