Code


eCommerce MVC is developed in modular fashion. In this section we will go into details of each module and inner workings of its structure.

Project Structure

The project is developed with ASP .Net MVC with the following modules and file structurs. Check the explanation below the tree.

    1) eCommerceMVC.Web

    This is the main ASP .Net MVC Project in the solution. Users will be interacting with this module in their browsers.
    For Dashboard Panel, we have created a separate area named Dashboard which have separate routes, controllers, models and views.

    1.a) Controllers

    We have Controllers in three places in the project. One is in main Controllers folder and the others are in Dashboard Area Controllers folder & API Area Controllers folder.

    1.b) Views

    Similar to Controllers, we have views in two Views folders. One is in main Views folder and the other is in Dashboard Area Views folder.

    1.c) Templates, Styles, Scripts, Fonts and Other Files

    All the files related to Templates, Styles, JavaScript/jQuery, third party libraries, SASS, Less, Fonts and Images exists in Content folder.

    1.d) ViewModels

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

    1.e) Error Pages

    eCommerce MVC 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) eCommerce.Data

    This module is a Class Library Project in the main solution. This is responsible for handling everything related to Database.
    eCommerce MVC uses Entity Framework Code First Migrations to create database. eCommerceContext class is derived from DbContext class of Entity Framework. Read more details of Database creation/setup etc in Setup section.

    3) eCommerce.Services

    This module is also a Class Library Project which act as intermediary between eCommerce.Data database module and eCommerceMVC.Web module.

    4) eCommerce.Entities

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

    5) eCommerce.Shared

    This module contain a helpers, extensions, attributes and common enums that are shared accross all the other projects in the eCommerce MVC solution.