This is web application made for a university project. The users are supposed to be 'Students', 'Professors' and 'Secretaries'.
The Professors can register the grades for each student and for each course taught, while each Student can access his account to see his grades. The Secretaries can add more students and professors to the database, as well as assign courses to professors and students.
Home page:
Login page:
Student Pages:
Professor Pages:
Secretaries Pages:
-
The app was developed with Visual Studio 2022 using
Asp.NET Core framework (Model View Controller) version 6.0
. The language isC#
. -
For the database we used
Microsoft Sql Server 2022
and the DBMS Microsoft SQL Server Management Studio 18/19. -
Bellow is the relation schema of the database:
-
A technical manual and a user manual are also provided in Greek under the
docs
folder. -
The session management is handled with a custom way. The Login is performed with the View
Login.cshtml
, which has the following action method:
[HttpPost]
public ActionResult Login(User user)
{
_context = new UniversityDBContext();
var obj = _context.Users.Where(a => a.Username.Equals(userUsername)
&& a.Password.Equals(user.Password)).FirstOrDefault();
if (obj != null)
{
HttpContext.Session.SetString("username", obj.Username.ToString());
HttpContext.Session.SetString("userid", obj.Userid.ToString());
HttpContext.Session.SetString("role",obj.Role.ToString());
return RedirectToAction("Index", obj.Role);
}
return RedirectToAction("Login");
}
-
Through a Post request, an object of type User is sent to the Server (it contains only the Username and Password fields - the rest are null) and checks if a User with the given credentials exists in the database. If no user is found, a redirection is made to the Login page. Alternatively, if the corresponding User object is found, 3 fields are created in the Session:
- Username
- Userid
- Role
Once the user has logged in, the corresponding Controller is utilized. Each action method performs checks in order to evaluate whether the user has the rights to call it. For example, let's see a method from StudentsController:
[ResponseCache(NoStore = true, Location = ResponseCacheLocation.None)]
public IActionResult Grades(string? sortOrder)
{
if (HttpContext.Session.GetString("userid") == null)
return View("AuthorizationError");
if (!(HttpContext.Session.GetString("role").Equals("Students")))
return View("NoRightsError");
// rest of the code ...
}
- Before the business logic of the method is perform, we make sure the user has logged in and has the appropriate role.
- Visual Studio 2022
- Microsoft Sql Server 2022
- Microsoft SQL Server Management Studio 18/19
-
Clone the repo or download as .zip
-
Open
Microsoft SQL Server Management Studio 18/19
and create a new database -
Open the sql scripts located inside the folder
SQL_scripts
in MSQL Management Studio by choosingFile > Open
-
Execute the sql scripts in the following order:
- SQLQueryTables.sql
- SQLQueryInsertsPart1.sql
- SQLQueryInsertsPart2.sql
- SQLQueryInsertsPart3.sql
-
Now you have a database ready and filled with dummy data for testing
-
Open the .sln file of the project with Visual Studio
-
Place the correct connection script inside the files
appsettings.json
andModels/UniversityDBContext.cs
-
App is now ready! You can use the following accounts:
- Secretary: username: aboyda0, password: Jgx8bp1zRC
- Professor: username: cbococka, password: Sc5GIg
- Student: username: jibbesonu, password: pFVJ4ra