You are on page 1of 6

Cloud System DevOps (CIS3003-N)

Reprise My Producks Exercise


Objective

This exercise aims to revise and refresh the technology stack you have used in your
previous studies, taking into account updates made to the tools and frameworks
since, and evaluate the architecture you have been using.

Instructions

You are to develop a combined ASP.NET Core MVC web app and API service with
the following functional requirements:

• Admin web pages to perform CRUD operations on the local Producks.Data data
source;
• An API interface to provide lists of categories, brands, and filtered (by category,
brand, and/or price) products from the local Producks.Data data source;
• A client-facing web page to provide drill-down/filtered browsing of products by
category and/or brand from all available data sources.

You should have the RepriseMyProducks source code (see Blackboard) which
contains a Visual Studio solution containing two projects: Producks.Data and
Producks.Web. Ensure the source is cloned (copied) to the local disk (e.g. the
source folder of your local user space), and ensure the project builds and executes
successfully – this may involve selecting Producks.Web as the start-up project and
agreeing to trust the standard developer security certificate.

The web application header contains links to three pages, each page displaying the
classic CRUD functionality for categories, products and brands. Consider this the
admin interface mostly completed already.

The Producks.Data is an Entity Framework Core Code-First generated domain


model that is currently persisted via the LocalDb SQL server within Visual Studio.

You should read this entire document before you begin working.

Cloud System DevOps (CIS3003-N) Page 1 of 6


Guidance

Use the tutorial steps later in this document as a guide for completing the work –
there is no reason to think you should be able to do this work without guidance. Ask
for help if you are stuck.

Refer back to your previous studies when necessary. If you have not used these
technologies before, or have completely forgotten what they are about, try the
following online tutorials first:

Roth, D., Anderson, R. and Luttin, S. (2020) Introduction to ASP.NET Core.


Available as: https://docs.microsoft.com/en-us/aspnet/core/introduction-to-aspnet-
core?view=aspnetcore-2.2 (Accessed: 28 September 2020).

Anderson, R. (2019) Get started with ASP.NET Core MVC. Available at:
https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-mvc-app/start-
mvc?view=aspnetcore-2.2&tabs=visual-studio (Accessed: 28 September 2020).

Anderson, R., Larkin, K. and Wasson, M. (2020) Create a web API with ASP.NET
Core. Available at: https://docs.microsoft.com/en-us/aspnet/core/tutorials/first-web-
api?view=aspnetcore-2.2&tabs=visual-studio (Accessed: 28 September 2020).

It is suggested that you use Open Broadcast Software (OBS), which is available on
the lab machines, to capture one or more movies of your application building and
executing successfully for demonstration purposes.

Use source control (e.g. Git) and other appropriate development tools (e.g. bug
trackers). Use source control formally (i.e. branch, merge, and tag) as appropriate to
your dev method.

Cloud System DevOps (CIS3003-N) Page 2 of 6


Tutorial

Complete the HTTP API Interface [required]

Ensure that you have downloaded the relevant files (see instructions section
above) before starting this tutorial.

Modify the ApiController called ExportsController by implementing Actions to expose


suitable GET actions against the Producks.Data domain model for:

• All brands
• All categories
• Products filtered by category, brand and/or price range.

Remember to design suitable DTO “wire” representations of the data to hide


inappropriate levels of information from our clients. Brand has been provided as an
example.

Provide Drill-Down Web Page Navigation [required]

Add a new controller called StoreController; scaffold it as an Empty MVC Controller.


Add an Index method to the controller (and an associated View to the Project) to
display a list of categories – you can use the existing CategoriesController as
inspiration. Add the capability to drill-down from a category into the associated
products – this will require a link in the Index view to a new Action that displays
products-by-category, which itself will require another View adding to the project –
this time you can use the existing ProductsController for inspiration. Remember to
tweak the views to take into account that all products have the same category.

Honour Soft Delete [required]

The database contains an Active column for each table that enables entities to be
soft deleted (left in the database but marked as inactive). Modify both the
StoreController and the ExportsController to honour soft delete by never displaying
inactive products, inactive categories, inactive brands or products belonging to
inactive categories or brands. Remember to remove all references to the Active field

Cloud System DevOps (CIS3003-N) Page 3 of 6


from the generated HTML views and DTO objects. Our clients should never know
about Active and the soft-delete mechanism.

Introduce View Models [recommended]

The current implementation of the web application pulls the domain model objects
and passes them to the views. What is displayed is directly generated from what is
represented in the domain. Sometimes it is useful to manipulate, restrict or augment
the data before it reaches the view (e.g. display “in stock” rather than the precise
stock count). Refactor the web application to use view models to communicate
between controller and view.

Provide Drill-Down by Category or Brand [recommended]

Modify the StoreController’s Index method and View so that there is both a list of
categories and a list of brands displayed, from which the user can drill-down into the
associated products. The ideal implementation would utilise dropdown boxes to filter
a list of all products, but other approaches are valid. Remember to honour the
inactive flag on all entities.

Consume HTTP Services [required]

Modify the StoreController so that it pulls brands, categories and products from the
UnderCutters HTTP service (http://undercutters.azurewebsites.net) and combines
them with the local Producks.Data data for display to the user. Remember you will
need to create local DTO representations of the UnderCutters data model.

Introduce the Remote Façade Pattern [recommended]

Refactor the models and code that accesses the HTTP UnderCutters service into its
own C# class library. The Producks.Web app will now use this class library and as
such will no longer contain any HTTP client code.

Introduce the Repository Pattern [recommended]

Producks.Web currently contains the query logic (e.g. soft delete), as well as being
responsible for exposing the business data and logic via HTTP resources. Provide
an abstraction between the Producks.Web and the Entity Framework implementation

Cloud System DevOps (CIS3003-N) Page 4 of 6


of the Producks.Data domain model using the Repository pattern. Add a new C#
library, and refactor the domain querying functionality into it. Once complete, the
repository will encapsulate appropriate queries against the domain model, which
should mean no client of the domain (i.e. Producks.Web) will include complex query
code. Consider any appropriate “joins” to perform within the repository
implementation to reduce future SQL calls made against the database.

Diagram the Current Architecture [required]

Study the code and create an architecture diagram showing how it is designed. Do
not worry about a formal definition of an architecture diagram or worry about using a
specific formal diagram notation. The important thing is to capture the main software
components, where they reside, and how they are related and interact. Include the
important detail and avoid the insignificant. Think about and diagram the flow of
execution through the architecture for the important operations.

Deploy to Azure [recommended]

Sign-up to Visual Studio Dev Essentials (https://www.visualstudio.com/dev-


essentials/) which includes a year of free Azure credits. Register for Azure, and
experiment with deploying your app into the cloud. You should give consideration
towards where the database will now reside and update the connection string as
appropriate.

Redesign the Data Transfer Objects [recommended]

Consider ways to reduce the potential traffic on the HTTP API interface by adjusting
the DTO types being used to include aggregate/composite data. You may need to
introduce additional DTO types.

Improve the HTML Views [recommended]

The default scaffolded views are informative but not particularly attractive. They also
are likely to contain unnecessary or badly labelled data. Refactor all of the views to
be consistent, clean and concise.

Cloud System DevOps (CIS3003-N) Page 5 of 6


Document History

Revision 1 (28-Sep-20): This is the initial version of the 2020/21 exercise.

Cloud System DevOps (CIS3003-N) Page 6 of 6

You might also like