This document provides an overview of building an eCommerce site using nopCommerce and the MVC framework. It describes the key components of MVC including models, views, controllers and actions. It then explains how nopCommerce implements these MVC concepts with models, views, controllers, routing and libraries. Key features of nopCommerce like plugins, the admin site, and domain object mapping are also summarized.
1. Build a MVC eCommerce Site
in Under 5 Minutes
Gaines Kergosien
@gainesk
http://dotnetdude.net
Sr. Solutions Architect
http://www.vanick.com
2. 2
What is nopCommerce?
Open Source
Product Catalog
Categories
Products/Variants
Customer Management
Order Management
Mobile Support
Discounts
Wish Lists
Gift Cards
Newsletters
Recurring Payments
Reporting
Payment Methods
Shipping Methods
Taxes
External Auth
Polls
News
Blogs
Forums
Multiple Stores
3. Why this topic?
3
Why MVC and WCF?
Decoupled
Scalable
Reusable
Maintainable
Why nopCommerce?
Top eCommerce app on MS Web Matrix
Open Source (GPLv2 License)
3
10. Views
A view is a standard (X)HTML document that
can contain scripts.
Views support ASP.NET markup or Razor
Razor markup used in nopCommerce
nopCommerce views are strongly typed
12. HTML Helpers
Methods which typically return string.
Used to generate standard HTML elements
textboxes, dropdown lists, links etc.
Usage is optional
You can create your own HTML Helpers
14. Controllers
Class derives from System.Web.Mvc.Controller
Generates the response to the browser request
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
public ActionResult About()
{
return View();
}
}
15. Controller Actions
Public method of the Controller class
Cannot be overloaded or a static method
public class HomeController : Controller
{
public ActionResult Index()
{
ViewBag.Message = "Welcome to ASP.NET MVC!";
return View();
}
public ActionResult About()
{
return View();
}
}