Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

Working with the Project and Adding New Features using Visual Studio for Mac

Steve Smith edited this page Sep 12, 2019 · 10 revisions

New Feature: Track My Order

Let's add a new feature to the site that will allow authenticated users to view the current status of their orders. Orders should display their status on the Orders page, which should have the following options:

  • Pending
  • Out for Delivery
  • Delivered

Clicking on the link should present the user with more detailed information. In the case of Pending, nothing else will be shown. Out for Delivery should provide an estimate for when the order will be delivered. Delivered should note the time when the order was delivered.

Update the UI

We can start on this feature from either end, working from the domain model first or from the UI first. In this case, since there's not much domain logic involved and the UI is pretty straightforward, let's start with the UI. First, we need to update the Orders view so that it displays the current order status of each order, which should a link to the order details page that will show more details about the status.

Next, we need to construct the order details page, including the information on the order's delivery status.

These changes will force us to modify the ViewModel used by Orders so that we can display the appropriate order status and related details.

Update the Model

In order to populate the ViewModel, we'll need to get the order status information from our domain model. So, we'll add that information. We will also need to know when an order was delivered, so we'll need to add that to the Order model as well.

Update the Database

Once we've made our changes, we can update the database by adding new migrations and then calling dotnet ef database update with the appropriate arguments. At this point, we're ready to run the application and see if it works.

Clone this wiki locally