Monday, February 26, 2018

Microsoft MVC — .Net / C# Web Technology That's Simple and Intuitive

Recently I was looking for an excuse to create a Web App using Microsoft's MVC technology — not because I hadn't done this before, but it had been a while and I was looking to get hands-on with "something real". In particular, I wanted something "simple, but capable of interacting with a user, being based on a non-trivial data model with Business Objects, and therefore needing to have a database persistence layer". I rejected the idea of using an ORM — even though Entity Frameworks is now an open source object-relational mapping (ORM) framework for ADO.NET — simply because I wanted to get some practice writing a few Stored Procedures using Microsoft's T-Sql. From this came the idea for the MVC Web Application described herein and called “MyCause”.

The purpose of MyCause, as a Web App, is that it provide a globally-accessible mechanism for setting up the metadata for the Mobile App that I call Active Wallpaper. One instance of this App might look like what you see in the mock screen shot, below.

There are two Business Objects with a 0:many relationship between them. The MyCause BO represents the background picture, which is the main part of the App's content — it's just wallpaper — and the collection of Slogan BOs are the Phrases that the designer wants to have displayed in the Marquis area.

Changing the verbiage to reflect the sample shown on the left… “Unitarian Universalism” would be The Cause that this App is in support of, and shown in the graphic is just one of the Slogans (“The inherent worth and dignity of every person”), which according to this link would be referred to as “the Principle of Unitarian Universalism” that the App is currently displaying.

Aside from highlighting the MVC C# piece, the MyCause Web App also features a JavaScript part where AJAX is used to fetch information from the server (from the underlying database) without having to do a resubmit of the page. In the screen shot on the right, first you see only the UU MyCause metadata along with the button "LookUp the Slogans". When you click on that, AJAX (via JavaScript, in the browser) is used to request the Slogans data that is then returned and made visible (the blue background) along with the metadata. So immediately you can see the “Associated Slogans Table” for the MyCause instance you are editing.

The intention of this portfolio is that I make my C# code available to others... so if you are interested in getting your hands on this MVC App, simply contact me and we'll have a conversation about that.