The presentation layer is a conventional ASP.NET MVC 4 application built on Razor views and the standard controller/action/view pipeline. What makes this project’s layout system distinctive is its heavy use of child actions —Documentation Index
Fetch the complete documentation index at: https://mintlify.com/aws-samples/legacy-cycle-store-mvc-app/llms.txt
Use this file to discover all available pages before exploring further.
SiteLayoutController exposes three independent action methods (HeaderLayout, FooterLayout, ContentLayout) that the master Razor layout calls via Html.RenderAction, allowing each region of the page to fetch its own data independently of the page controller. Understanding this pattern is essential to following the flow of any page request through the application.
Routing
The application registers a single conventional route inApp_Start/RouteConfig.cs:
{controller}/{action}/{id}. The defaults mean that a bare request to / resolves to HomeController.Default(). The id segment is optional, so both /Home/Default and /Home/Default/42 are valid — the latter passes 42 as the id route value.
The Web API route registered in WebApiConfig.cs uses the separate prefix api/{controller}/{id} and does not overlap with the MVC route.
HomeController
HomeController has a single action that serves the homepage.
ViewBag.BodyClass is set to "homepage" so the Razor layout can apply a page-specific CSS class to the <body> element (e.g., <body class="@ViewBag.BodyClass">). The action returns View() with no explicit view name, so MVC resolves it to Views/Home/Default.cshtml by convention.
Default.cshtml does not render any product data itself — it delegates entirely to the SiteLayoutController child actions for its visible content.
SiteLayoutController
SiteLayoutController acts as a data-provider for the three composable regions of the page layout. Its actions are never called directly via a top-level URL; they are invoked as child actions by Html.RenderAction calls inside the Razor views.
HeaderLayout
Creates an empty
SiteLayoutModel and passes it to Views/SiteLayout/HeaderLayout.cshtml. The header view renders the site logo and the “Unicorn Bike Rentals” banner. No category data is loaded here because the header does not display navigation links.FooterLayout
Calls
CategoryManager.GetMainCategories() to populate SiteLayoutModel.ProductCategories, then passes the model to Views/SiteLayout/FooterLayout.cshtml. The footer view uses the category list to render navigation links at the bottom of every page.SiteLayoutModel
SiteLayoutModel is the single view model class used across all three layout views.
| Property | Type | Status |
|---|---|---|
ProductCategories | List<ProductCategory> | Active — populated by FooterLayout and ContentLayout, iterated in the corresponding views. |
AnonymousTemplateVisibility | string | Placeholder — intended to control the CSS visibility of UI blocks shown only to anonymous (not logged-in) users. Not set by any current controller action. |
LoggedInTemplateVisibility | string | Placeholder — mirrors AnonymousTemplateVisibility for authenticated users. Not set by any current controller action. |
LoggedInEmailID | string | Placeholder — intended to display the current user’s email address in the header. Not wired to any authentication provider. |
ShoppingCartItemsCount | string | Placeholder — intended to show the number of items in the user’s cart. No shopping-cart functionality is implemented. |
Views
The views form a two-level composition chain: a master Razor layout wraps all pages, and individual page views slot their content into that layout.Layout Chain
Shared/_SiteLayout.cshtml
Shared/_SiteLayout.cshtml
Home/Default.cshtml
Home/Default.cshtml
The homepage view. Sets
Layout to _SiteLayout.cshtml and its body consists primarily of a call to Html.RenderAction("ContentLayout", "SiteLayout"). This delegates the rendering of the category navigation sidebar to SiteLayoutController.ContentLayout(), which fetches categories from the database and passes them to ContentLayout.cshtml.SiteLayout/ContentLayout.cshtml
SiteLayout/ContentLayout.cshtml
Receives a
SiteLayoutModel with ProductCategories populated. Iterates the list with a foreach loop, rendering each category name as a heading. For each category, it iterates category.ProductSubcategories and renders each subcategory as a navigation link. This view is the primary navigation UI for the entire site.SiteLayout/HeaderLayout.cshtml
SiteLayout/HeaderLayout.cshtml
Renders the
<img> tag for logo.png and the “Unicorn Bike Rentals” heading text. Receives an empty SiteLayoutModel — no data queries are needed for this region.Error/Default.cshtml
Error/Default.cshtml
The generic error page. Rendered both by
ErrorController.Default() when the error route is hit directly, and by the HandleErrorAttribute global filter when an unhandled MVC exception occurs.Error Handling
Error handling is configured in two places that work together. FilterConfig.cs registersHandleErrorAttribute as a global MVC action filter:
HandleErrorAttribute intercepts it, sets the HTTP response status to 500, and renders Views/Error/Default.cshtml using the HandleErrorInfo model.
Web.config complements this by mapping HTTP error codes to the error route at the IIS/ASP.NET pipeline level:
HandleErrorAttribute) and errors surfaced by IIS before MVC is even reached (such as a 404 for a missing static file) both end up displaying the same friendly error page.