2
I have the following wheel on an Asp.net mvc control:
[Route("video/categoria/{categoria}/{page?}/{sort?}")]
The three parameters are: categoria
, filters the video category, page?
is the pagination of the result, sort?
is the order by of the query, more visas or more new.
First situation: First page of a category
\video\categoria\comedia
or
\video\categoria\comedia\1
Second situation: second page of a category
\video\categoria\comedia\2
Let’s take the 3 cases and put the order, and include the order parameter, that’s where I had my first problem.
\video\categoria\comedia\mais_vistos (Erro...)
\video\categoria\comedia\1\mais_vistos
\video\categoria\comedia\2\mais_vistos
I understand perfectly that the error comes the moment it tries to put "more viewed" inside the control page variable.
My solution was to put everywhere you have the link to order the page 1 before. I believe it is the right thing to do. video category comedia 1 more_visa
Now I have another problem, another 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, not adult)
Assuming that I gave the solution to put the page 1 whenever I want to use the order parameter, I have the following cases:
\video\categoria\comedia
\video\categoria\comedia\1
\video\categoria\comedia\2
\video\categoria\comedia\1\mais_vistos
\video\categoria\comedia\2\mais_vistos
I’m thinking of applying the same solution, only now both in the page parameter and in the Sort parameter (the default is more):
\video\categoria\comedia
\video\categoria\comedia\1\mais_vistos\adulto
\video\categoria\comedia\1
\video\categoria\comedia\1\mais_vistos\adulto
\video\categoria\comedia\2
\video\categoria\comedia\2\mais_vistos\adulto
\video\categoria\comedia\1\mais_vistos
\video\categoria\comedia\1\mais_vistos\adulto
\video\categoria\comedia\2\mais_vistos
\video\categoria\comedia\2\mais_vistos\adulto
That would be the best solution?
I would like opinions even from those who agree with the solution, leave at least one comment saying that you think the best suggestion.
Your entire experience is welcome.
UPDATING
The route refers to this method:
public async Task<ActionResult> ConsultaVideo(string categoria, int? page, string sort)
Now he must stay like this:
public async Task<ActionResult> ConsultaVideo(string categoria, int? page, string sort, string genero)
You can also put the headers of each Action in the question?
– Leonel Sanches da Silva
Sorry it took so long, I was having lunch, question edited with Action’s signature
– Ricardo