C
C#14mo ago
wwww

❔ Web things :)

hi, i have small web app (pet. proj.) which should be smthing like shop,where u can add your products. So want to ask how ppl do some things in prjoects like this. 1 - Log in, Reg/Log out Buttons in header (screenshot 1). So in my case in every page's js file i have onload func to checks cookies for authorization thing, like -
window.addEventListener("load", async () => {
await FillProducts();

if (document.cookie.includes(".AspNetCore.Cookies")) {
ButtonLoged();
}
else {
ButtonNotLoged();
}
});
window.addEventListener("load", async () => {
await FillProducts();

if (document.cookie.includes(".AspNetCore.Cookies")) {
ButtonLoged();
}
else {
ButtonNotLoged();
}
});
and there is functions which loads needed buttons based on authorization status. what do u think about this way to handle problem? 2 - i want to make page of products (screenshot 2), like on screenshot, have no clue how to make this, any advices? i thought i can load like, if page is 1, i load 1-25 items from db, on page 2 load 26-50, on page 3 load 51-75. but i think its a bit hard to do like this, especially when it comes to load data with filters, (or maybe i should use default mssql with join's instead of Ef core?). or maybe there is some technologies especially for that thing.
No description
No description
3 Replies
Angius
Angius14mo ago
ad. 2: that's how it's done So, yeah, you're spot-on
Pobiega
Pobiega14mo ago
you can probably google "pagination with EF Core" and get some good results, but an easy way to build it yourself is just .Skip(itemsPerPage * pageCount-1).Take(ItemsPerPage)
Accord
Accord14mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server