Dynamic MVC Order Entry Tutorial - Create Orders

This tutorial has been updated to version 3.0.
Sat, 30 Oct. 2014 - Chris Perry

Create A Order Model

The Order model contains navigation properties to both Customer, OrderLines, and OrderStatus. The current naming convention is understood by both Code First and Dynamic MVC.

Create A OrderStatus Model

The OrderStatus model will be used to track orders throughout the order processing, which starts with "New Order" and ends with "Order Shipped."

Create A OrderLine Model

The OrderLine model links an Order to a Product.

Update The Database With Code First

Create the three DbSet properties in the data context for each new model to the data context. Create a migration with the "add-migration" command. Once the migration is reviewed, update the database using the "update-database" command.

Test Drive Dynamic Pages

Run the application. Navigate to OrderStatus page. Create three new OrderStatus records: New Order, Processing, and Shipped. Navigate to the Orders page. Notice we can filter by OrdersStatus or Customer. Create an Order by clicking the create hyperlink. Notice the OrderLines hyperlink on the orders page for each order record. Click the OrderLines hyperlink. Notice the Order Filter is showing the primary key of the order. Dynamic MVC will look for the first property that contains “Name” or “Description” as the text to display in the drop down. If this cannot be found, it displays the primary key. Although this is functional, it is not very practical. In our next tutorial we will see how we can customize the orders dynamic views.

COMMENTS Add Comment
  • Knlgeodwe wants to be free, just like these articles!
    Drri6vb1fsk | 3/30/2016 7:57:05 AM
  • It's about time somenoe wrote about this. http://buaiamvhr.com [url=http://fspopok.com]fspopok[/url] [link=http://wbqagmav.com]wbqagmav[/link]
    DJW95ZuHfWd | 4/8/2016 9:04:45 AM