US11-Implement Model-View-Controller Design Pattern
Description
As a developer for the site, I want to create a model-view-controller design pattern to properly split our application into separate layers, allowing for separation of roles and better maintenance of code.
Acceptance Criteria
- After completing the MVC design pattern diagram, review with internal team of developers and ensure everyone agrees with structure and tools included.
- With approval, obtain screenshot of file directory and upload to team site.
- Also, provide a code example of controller, agreed upon by developers to be displayed.
Tasks
- Create MVC diagram using PowerPoint, because Visio download failed - 30 min (Marty)
- Partner with developers on team to obtain screenshot of file directory - 30 min (Marty & Team)
- Review MVC diagram, file directory, and code example of controller with team on weekly standing call - 30 min (Marty & Team)
- Make modifications, revise diagrams, and upload to team site - 30 min (Marty and Ahmad)
Screenshots
-
MVC Diagram View Full Size Image
-
File Directory Structure View Full Size Image
Controller Example
//Get page route
string pageRoute = Page.RouteData.Values["route"].ToString().Replace("/", "").Replace(".html","");
//Choose View
switch (pageRoute.ToUpper())
{
case "CART":
ContentPlaceHolder contentPlaceHolder = (ContentPlaceHolder)this.Master.FindControl("mainContentHolder");
UserControl userControl = this.LoadControl("~/Views/Checkout/CartView.ascx") as UserControl;
if ((contentPlaceHolder != null) && (userControl != null))
contentPlaceHolder.Controls.Add(userControl);
break;
default:
break;
}