On many occasions, when we organize large events, we need to build an informational web portal to be able to show our users the date of an event, the sessions that will be held, information about the organizers and sponsors, and also a section for them to register.
For these purposes, in this article, we will review how to build an informational web portal, with ASP.NET 5, starting from the database, to the design of the corresponding website with a technology called DotVVM on .NET, which will help us with the design process.
Previous article: a web portal for event management
In a previous article we were able to analyze how to build a dashboard to manage our event data, whose portal looked like this,

The tutorial article to build this dashboard can be found here: Web portal to manage events and conferences with ASP.NET 5 and DotVVM.
And the source code in this repository on GitHub: EventAdmin.
Sections of the information website
This informational website is for the sole purpose of presenting data to the user (no information will be saved from this page), whose highlighted sections are as follows,
- Main section or cover. Shown here is the event title and some general information, such as the event date and location.
- Event Schedule, which lists the talks or conferences with which the event will count, along with the speakers, and the start times for each of these sessions.
- Organizers, to show in general to those communities and/or institutions that are organizing the event.
- Sponsors. Here you can show those sponsors who are supporting the event.
- Registration, where indicated or displayed to the user where they can register to be part of the event.
The final result of the web page will look approximately as follows,

Now that we are aware of the sections that will be included, let's start building our web portal.
Solution Structure
All part of the database where the event information is stored. For this platform, the entities in the database are,
- Organizer
- Sponsor
- Event
- Speaker
- Session
- Speaker_has_Session
- SessionLeveland
- SessionType

Note
As a database manager, we plan to use SQL Server.
However, if we consider Visual Studio as a working environment for the construction of this website, in this solution we will have three projects,

- Data Access Layer (DAL) - A class library to handle connection and access to the database.
- BL (Business Layer) - another library of classes for the management of services and the logic of the website domain.
- APP - App presentation layer. This section is where we have the Views and Viewmodels for the layout of the event web page with DotVVM. With this in mind, let's now look at the steps we need to take in these three projects for the development of our web portal.
DAL – Data Access Layer
This first project corresponds to a class library. In this sense, as a first task, we have to relate our project to the database in SQL Server. We can achieve this goal with entity framework, through the Database-First approach, so that we can generate the classes of existing entities from our database.
In this project we will need three Nuget packages,
-
Microsoft.EntityFrameworkCore.Design
-
Microsoft.EntityFrameworkCore.Tools
-
Microsoft.EntityFrameworkCore.SqlServer
From the package management console we can do Scaffold, to generate the classes from existing entities using the following command,
- Scaffold-DbContext "Server=YOUR_SERVER; Database=DATABASE_NAME; Username=YOUR_USERNAME; Password=YOUR_PASSWORD Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir DAL/Entities
When the console process is complete, we'll have something like this,

So far, the connection and configurations required to work with the SQL Server database are ready.
BL – Business Logic Layer
Now it's up to us to define the models and create the services to handle the logic of our application. In this case, we will create a second class library to have a general list of entities (
- Event,
- Organizer,
- Session,
- Speaker,
- Sponsor
- ) and the specific information of each of them.
In the solution within Visual Studio 2019 about the EventPortal.BL project we will have something like this,

Similarly with the administrative web portal, for this website, there is an important aspect to mention, and it corresponds to the identification of the event since the database is designed so that several events can be handled at once. In the EventId class, inside the Services folder, you can control the ID of the event we want to work with.
- public class EventId
- {
- private static EventId instance { get; set; } = null;
- public int Id { get; set; } = 1;
- private EventId() { }
- public static EventId GetInstance()
- {
- if (instance == null) {
- instance = new EventId();
- }
- return instance;
- }
- }
With this mentioned, in this class library, we have two important parts. As a first point, the models specify the attributes with which we want to work for each of the corresponding cases.
The models are as follows,
Models
- EventModel
- OrganizerModel
- SessionModel
- SpeakerModel
- SpeakerHasSessionModel
- SpeakerModel
- SponsorModel
The second important part to consider his services. All these services have methods, whose sole purpose is to consult the list of records for a particular case. In this sense, the methods of these services are as follows,
| Services | Methods |
|
EventService
|
GetEventByIdAsync()
|
|
OrganizerService
|
GetAllOrganizersAsync()
|
|
SessionService
|
GetAllSessionAsync()
,
GetAllSessionByDayAsync(DateTime date)
, y
GetSpeakerHasSessionList(int IdSession)
|
|
SpeakerService
|
GetAllSpeakerAsync()
, y
GetSpeakerByIdAsync(int IdSpeaker)
|
|
SponsorService
|
GetAllSponsorsAsync()
|
Most methods of the services are intended to obtain a list of records. However, in the case of SessionService, there are two additional methods, the first GetAllSessionByDayAsync(DateTime date) to get all sessions from a given date, and the second GetSpeakerHasSessionList(int IdSession) to get the speakers associated with a session. Similarly, SpeakerService has an additional method called
GetSpeakerByIdAsync(int IdSpeaker) , where you can get a specific speaker, along with listing its associated sessions. With this mentioned, let's review the layout of the website for our attendees.
PL – Presentation Layer
Now that we have defined the whole part for data handling, we can start designing each of the sections of the website. In DotVVM, pages consist of two parts,
- A View, which is based on HTML syntax and describes what the page will look like.
- A ViewModel, which is a class in C- that describes the state of the page (for example, values in form fields) and handles user interactions (for example, button clicks).
Considering the Views and Viewmodels files for the web page, in Visual Studio 2019 for this project we'll see the following,

According to each of the sections of the page (cover, event schedule, organizers, sponsors, and registration), then we will analyze each of these sections, along with the format of the page.
General Page Format
In DotVVM, master pages or master pages are known as Masterpage, whose files have a .dotmaster extension. In this case, this page will be useful to set our HTML skeleton, import CSS & JavaScript files, and define the contents that will be visible in all sections of the page (lists, forms, records).
In the MasterPage.dotmaster file, the overall structure of the web page is as shown below,

Where,
- Section 1, is the HTML header where you will find the page title, CSS fonts and referenced JavaScript files, and other specifications.
- Section 2, the header of the page, which will be useful to show the options or menu of this page

- Section 3, this is one of the most important parts of the MasterPage. This space displays the contents of the child page, whose ID corresponds to the MainContent.
- Section 4, here you will find the footer or footer of the page.







Join the conversation! Your thoughts help the community grow.