public ActionResult OrderDetails(int customerId, int orderId) { var order = _orderRepository.Get(orderId); ViewData["OrderDate"] = "Order Date: " + string.Format("{0:MM/dd/yyyy}", order.OrderDate); ViewData["BreadCrumbs"] = new List <BreadCrumb> { new BreadCrumb { Url = UrlMaker.ToDefault(), Title = "home" }, new BreadCrumb { Url = UrlMaker.ToAdmin(), Title = "administration" }, new BreadCrumb { Url = UrlMaker.ToOrders(), Title = "orders" }, new BreadCrumb { Url = UrlMaker.ToCustomerOrders(customerId), Title = "customer orders" }, new BreadCrumb { Title = "line items" } }; return(View(order.OrderDetails.ToList().ToModel())); }
public ActionResult CustomerOrders(int customerId) { ViewData["CustomerId"] = customerId; var customer = _customerRepository.GetCustomerWithOrders( new Criterion("CustomerId", Operator.Equals, customerId)); ViewData["Company"] = customer.Company; ViewData["BreadCrumbs"] = new List <BreadCrumb> { new BreadCrumb { Url = UrlMaker.ToDefault(), Title = "home" }, new BreadCrumb { Url = UrlMaker.ToAdmin(), Title = "administration" }, new BreadCrumb { Url = UrlMaker.ToOrders(), Title = "orders" }, new BreadCrumb { Title = "customer orders" } }; return(View(customer.Orders.ToList().ToModel())); }
// establishes the composite menu hierarchy which is present on all pages. protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // build the composite menu tree // this tree implements the Composite Design Pattern var root = new MenuCompositeItem("root", null); var home = new MenuCompositeItem("home", UrlMaker.ToDefault()); var shop = new MenuCompositeItem("shopping", UrlMaker.ToShopping()); var prod = new MenuCompositeItem("products", UrlMaker.ToProducts()); var srch = new MenuCompositeItem("search", UrlMaker.ToSearch()); var admn = new MenuCompositeItem("administration", UrlMaker.ToAdmin()); var cust = new MenuCompositeItem("members", UrlMaker.ToMembers()); var ordr = new MenuCompositeItem("orders", UrlMaker.ToOrders()); MenuCompositeItem auth; if (Request.IsAuthenticated) { auth = new MenuCompositeItem("logout", UrlMaker.ToLogout()); } else { auth = new MenuCompositeItem("login", UrlMaker.ToLogin()); } shop.Children.Add(prod); shop.Children.Add(srch); admn.Children.Add(cust); admn.Children.Add(ordr); root.Children.Add(home); root.Children.Add(shop); root.Children.Add(admn); root.Children.Add(auth); TheMenuComposite.MenuItems = root; } }