I'm building an administrative application, and in this application I have a messaging page. I'm currently bringing the last 20 messages.
I already have the screen ready to receive this messages, but my problem is in making the button logic that show the next 20 messages, and so on.
//Mensagens Enviadas
List<Mensagem> mensagens = this.mensagemServico.GetMany(l => l.LojaId == loja.LojaId && l.OrigemId != 0).OrderByDescending(l => l.DataEnvio).Take(20).ToList();
mensagemModel.Mensagens = mensagens;
return View(mensagemModel);
Basically this is my routine: it takes the last 20 messages sorted by date, and according to the source (Customer Source == 0)
What I would like to do is that when I click on "Next" it will bring the next 20.
I had the initial idea of saving to a model variable (I have a MensagemModel
to return the value to View ) the amount already fetched from Messages, or current page to be able to have this control.
I'm a beginner so I have questions about how to pass some information between Views , such as Models , and how a pagination should be done.
If someone can help me, even if it's about the logic that should be followed to make this pagination, sorry to ask this kind of question but I do not want this pagination to be bad so I wanted your help, thank you.