Hello guys.
this is my first project in mvc and i have to check the users authorization every time they try to make a move(like press the button or ....).
at first let me explain little bit about my database:
i wrote a store procedure which allow me to send the user ID and function ID then returns the true or false. it means it checks the user can access to the function or not.
so far i guess it good enough.
now i know i should write a controller class to use this store procedure. but i don't know how and where!!!
for example when user click on to the edit users, he/she should redirect to right page.(if is authorize goes to the edit page if not goes to the log in page). i also don't want to write something like this:
if(userIsAuthorized) {
//do stuff
}
else {
//return to login page
}
i have so many pages and functions whats happen if just miss one of them!!!!
so as i said its my first mvc project and i heard with mvc we can do this kind of thing to easy. would you please help me?
one more thing:
how can pass the user information (user Id, first name, last name, .......) through the pages. how should i do it?
and a sample code could be very very help full.
thank you.