Quizbee

Code Structure

Quizbee is developed in modular fashion. In this section we will go into details of each module and inner workings of strcuture.

Project Module Structure

There are four projects in main solution file as follows.

QuizbeePlus Solution Architecture
1. QuizbeePlus

This is the main ASP .Net MVC Project in the solution. Users will be interacting with this module. It has the following architecture.

QuizbeePlus Web Architecture
1.a Controllers

There are 9 main Controllers in Quizbee as follows.

  1. Base Controller

    This is a simple controller which act as parent controller for most of other controllers. Other controllers are inherited from it. This controller has implementation related to Exception Handling, User Authorization and Unauthorized page redirection mechanism.

  2. Account Controller

    This controller handles everything related to account registeration, login and forget password, social media account registeration functionalities etc.

  3. Manage Controller

    This controller handles everything related to user profile functionalities etc.

  4. Home Controller

    This controller is only concerned with Home page. It has one Index action which displays most recently added quizzes on the homepage.

  5. Quiz Controller

    This controller handles functionalities related to Quiz such as creating new quizzes, listing user quizzes, updating quizzes and deleting quizzes.

  6. Question Controller

    This controller handles functionalities related to Questions and options such as creating, listing, updating and deleting quiz questions and options in questions.

  7. Attempt Quiz Controller

    As the name suggest this controller handles everything related to User Quiz Attempts.

  8. Control Panel Controller

    This controller is concerned with Admin actions.

  9. Shared Controller

    Some of the shared actions used in multiple areas of project such as Uplaoading Image etc is added in shared controller.

Authorization Mechanism in Controllers
As most of the Quizbee pages require authorization, we have used MVC authorize action filter. You will not find it on each controller becuase the controllers have been inherited from Base Controller. You can change authorization mechanism in Base controller and it will be update all over project controllers.

1.b Styles, Scripts, Fonts and Other Files

All the files related to Styles, JavaScript/jQuery, SASS, Less, Fonts and Images are stored in Content folder. Third party plugins and libraries are stored in plugins subfolder.

QuizbeePlus Contents Architecture
1.c Views

All controllers have their own separate view folders as shown in below screenshot. Partial Views have preceeding underscore in their name.

QuizbeePlus Views Architecture
1.d ViewModels

ViewModels have their own separate ViewModels folder. Each file in ViewModels folder contain many ViewModel classes.

1.e Error Pages

Quizbee also implements custom error pages which you can find in the main folder. Local development does not show these error pages as it is recommended to only be shown on the released environment. You can change this setting in web.config file.
Learn more about Error Pages in MVC in this Link.

2. QuizbeePlus.Data

This module is a Class Library Project in the main solution. This is responsible for handling everything related to Database.

QuizbeePlus Data Architecture

Quizbee uses Entity Framework Code First Migrations to create database. QuizbeeContext class is derived from DbContext class of Entity Framework. Read more details of Database creation/setup etc in Setup section.

3. QuizbeePlus.Entities

This module is also Class Library Project in the main solution. This project contain all the business entities/classes. This is referenced in all other projects in the main solution.

QuizbeePlus Entities Architecture
4. QuizbeePlus.Services

This module is a Class Library Project which act as intermediary between database module and main web module.

QuizbeePlus Services Architecture