Guide to organizing and promoting events through a web portal with ASP.NET 5
Tags: webdev, dotnet, html, csharp
Published: 2021-03-22 15:47:07

Hi! In this guide, we will learn how to manage and publicize our events, either in person or online, through two web portals.

##**Things to consider**

For the administration and dissemination of a particular event, the data or functionalities to be considered are as follows:

+ **Organizers:** information about the communities and/or institutions that are organizing the event. 
+ **Speakers:** information about the people who will present a session within the event. 
+ **Sessions:** where the presentations of the event are recorded, with their respective associated speakers, the type of the session (e.g. Keynote, workshop, talk, etc.), and the level of difficulty (basic, intermediate, advanced).
+ **Sponsors:** information from external communities, institutions, or companies that support the event.  

For these purposes, we will have two platforms with the same database. The first to manage the event data, and the second to present this data to the users or attendees of our event. 

In the case of the organizers section of an event, on both platforms we would have something like this:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/67tuubo772zop2yazsbz.png)

##**Previous articles**

In previous tutorial articles, the explanation for the construction of each of these portals is carried out in detail. Also, the source code of both projects can also be found here:

Tutorial 1: [Web portal to manage virtual or in-person events with ASP.NET 5 and DotVVM](https://dev.to/dotvvm/web-portal-to-manage-virtual-or-in-person-events-with-asp-net-5-and-dotvvm-fl9).

Demo 1: [Event Admin](https://github.com/esdanielgomez/EventAdmin).

Tutorial 2: [Building an event information portal with ASP.NET 5 & DotVVM](https://dev.to/esdanielgomez/building-an-event-information-portal-with-asp-net-5-dotvvm-3749).

Demo 2: [Event Portal](https://github.com/esdanielgomez/EventPortal).

##**Resources and tools required**

Both portals have been built with ASP.NET 5 & DotVVM. For configurations or functionalities that need to be implemented, the following working tools are required:

+ [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/).
+ Workload in Visual Studio 2019: Developing ASP.NET and Web.
+ [DotVVM Extension for Visual Studio 2019](www.dotvvm.com/landing/dotvvm-for-visual-studio-extension).

**Database**

Both portals share the same database, whose engine corresponds to SQL Server with entities: `Organizer`, `Sponsor`, `Event`, `Speaker`, `Session`, `Speaker_has_Session`, `SessionLevel`, and `SessionType`. 

![](https://dev-to-uploads.s3.amazonaws.com/i/uq66efzen3l8c8249y3r.png)

The first thing we have to do is set this database, for this, the SQL script can be found here:

```sql
-- -----------------------------------------------------
CREATE TABLE  Event (
  IdEvent INT NOT NULL IDENTITY(1,1),
  Name VARCHAR(45) NOT NULL,
  Description VARCHAR(500) NULL,
  Icon VARCHAR(45) NULL,
  StartDate DATETIME NOT NULL,
  EndDate DATETIME NOT NULL,
  RegistrationLink VARCHAR(45) NULL,
  StreamingLink VARCHAR(45) NULL,
  PRIMARY KEY (IdEvent))
;

-- -----------------------------------------------------
CREATE TABLE  Speaker (
  IdSpeaker INT NOT NULL IDENTITY(1,1),
  FirstName VARCHAR(45) NOT NULL,
  SecondName VARCHAR(45) NULL,
  FirstLastName VARCHAR(45) NOT NULL,
  SecondLastName VARCHAR(45) NULL,
  PhotoLink VARCHAR(45) NULL,
  TwitterLink VARCHAR(45) NULL,
  LinkedInLink VARCHAR(45) NULL,
  IdEvent INT NOT NULL,
  PRIMARY KEY (IdSpeaker),
  INDEX fk_Speaker_Event_idx (IdEvent ASC),
  CONSTRAINT fk_Speaker_Event
    FOREIGN KEY (IdEvent)
    REFERENCES Event (IdEvent)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
;

-- -----------------------------------------------------
CREATE TABLE  SessionType (
  IdSessionType INT NOT NULL IDENTITY(1,1),
  Name VARCHAR(45) NOT NULL,
  Description VARCHAR(45) NULL,
  PRIMARY KEY (IdSessionType))
;

-- -----------------------------------------------------
CREATE TABLE  SessionLevel (
  IdSessionLevel INT NOT NULL IDENTITY(1,1),
  Name VARCHAR(45) NULL,
  Description VARCHAR(45) NULL,
  PRIMARY KEY (IdSessionLevel))
;

-- -----------------------------------------------------
CREATE TABLE  Session (
  IdSession INT NOT NULL IDENTITY(1,1),
  Name VARCHAR(45) NOT NULL,
  Description VARCHAR(500) NULL,
  StartDate DATETIME NULL,
  EndDate DATETIME NULL,
  IconLink VARCHAR(45) NULL,
  IdSessionType INT NOT NULL,
  IdSessionLevel INT NOT NULL,
  PRIMARY KEY (IdSession),
  INDEX fk_Session_SessionType1_idx (IdSessionType ASC),
  INDEX fk_Session_SessionLevel1_idx (IdSessionLevel ASC),
  CONSTRAINT fk_Session_SessionType1
    FOREIGN KEY (IdSessionType)
    REFERENCES SessionType (IdSessionType)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT fk_Session_SessionLevel1
    FOREIGN KEY (IdSessionLevel)
    REFERENCES SessionLevel (IdSessionLevel)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
;

-- -----------------------------------------------------
CREATE TABLE  Speaker_has_Session (
  IdSpeaker INT NOT NULL,
  IdSession INT NOT NULL,
  INDEX fk_Speaker_has_Session_Session1_idx (IdSession ASC),
  INDEX fk_Speaker_has_Session_Speaker1_idx (IdSpeaker ASC),
  CONSTRAINT fk_Speaker_has_Session_Speaker1
    FOREIGN KEY (IdSpeaker)
    REFERENCES Speaker (IdSpeaker)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION,
  CONSTRAINT fk_Speaker_has_Session_Session1
    FOREIGN KEY (IdSession)
    REFERENCES Session (IdSession)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
;

-- -----------------------------------------------------
CREATE TABLE  Organizer (
  IdOrganizer INT NOT NULL IDENTITY(1,1),
  Name VARCHAR(45) NOT NULL,
  LogoLink VARCHAR(45) NULL,
  WebPage VARCHAR(45) NULL,
  Email VARCHAR(45) NULL,
  Description VARCHAR(45) NULL,
  FacebookLink VARCHAR(45) NULL,
  TwitterLink VARCHAR(45) NULL,
  InstagramLink VARCHAR(45) NULL,
  IdEvent INT NOT NULL,
  PRIMARY KEY (IdOrganizer),
  INDEX fk_Organizer_Event1_idx (IdEvent ASC),
  CONSTRAINT fk_Organizer_Event1
    FOREIGN KEY (IdEvent)
    REFERENCES Event (IdEvent)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
;

-- -----------------------------------------------------
CREATE TABLE  Sponsor (
  IdSponsor INT NOT NULL IDENTITY(1,1),
  Name VARCHAR(45) NOT NULL,
  LogoLink VARCHAR(45) NULL,
  Description VARCHAR(45) NULL,
  WebPage VARCHAR(45) NULL,
  IdEvent INT NOT NULL,
  PRIMARY KEY (IdSponsor),
  INDEX fk_Sponsor_Event1_idx (IdEvent ASC),
  CONSTRAINT fk_Sponsor_Event1
    FOREIGN KEY (IdEvent)
    REFERENCES Event (IdEvent)
    ON DELETE NO ACTION
    ON UPDATE NO ACTION)
;

```

A good option to consider for deploying our database to the cloud is Azure SQL Database, which is the same as SQL Server, only in the cloud. 

Here we can see a little more of this resource: [https://azure.microsoft.com/en-US/services/sql-database/](https://azure.microsoft.com/en-US/services/sql-database/).

##**Organization of projects**

Both projects have been developed taking into account the architectural pattern Model, View, Model View (MVVM), where:

+ **The model.** — will be responsible for all application data and related business logic.
+ **View**. — shall correspond to representations for the end-user of the application model. The view will be responsible for displaying the data to the user and for allowing manipulation of application data.
+ **Model-View or View-Model.** — one or more per view; the view-model will be responsible for implementing view behavior to respond to user actions and exposing model data easily.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8yt8d12m9xysm0q7bwxj.png)

And in Visual Studio 2019 we can visualize something like this for the *EventAdmin* and *EventPortal* projects respectively:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tr0qtkcqbvjw8ozlwcdk.png)

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wfnegext7hh0y7d0vo55.png)

All right, with this in mind, let's look at the considerations we should consider when using these two projects.  

##**Settings in BL – Business Layer**

For our case study, the database is designed to handle multiple events at once. In this sense, projects in the BL have a class called `EventId` to handle the ID of the event we want to work with. For both cases, in this class, we will have to place the corresponding `Id`.

```csharp
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;
    }
}
```

##**Settings in PL – Presentation Layer**

At the design level, our websites are composed of the following elements: 

+ **A view**, which is based on HTML syntax and describes what the page will look like. 
+ **A view model**, 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).

###**Administrative Portal**

For the administrative web portal we can find something like this:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/o1qd4jpw9a1vv0np7b99.png)

For this particular portal, there are no design changes at the design level that need to be implemented. In the final, on this website we will be able to view the following:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dz1bwgc22b1fdtkkudwj.png)

###**Information Portal**

For our second portal, the one that our attendees will see, here if there are changes or design styles that could be contemplated.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tjamv1c5uezkvdvzg7o0.png)

The structure in Visual Studio 2019 is as this:

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/asj0cnie9fr2zddqn3ph.png)

In which, the general structure of the website is located in the `MasterPage.dotmaster`:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/00sp7mne50mdj69k5xrr.png)

And the content of the page, defined by the `ContentPlaceHolder` control with the identifier `MainContent`, is located in the `Default.dothtml`.

![](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jyedjphw1o8rynlorynv.png)

Here we can make the changes that are considered relevant, taking into account the `ViewModel` where the definitions and collections that reference the corresponding data of the event are located.

```csharp
public List<SponsorModel> Sponsors { get; set; }
public List<OrganizerModel> Organizers { get; set; }
public List<CalendarSpeakers> Calendar { get; set; } = new List<CalendarSpeakers>();

public EventModel Event { get; set; }
```

####**Publish our informational web portal**

To deploy our project so that it can be accessed from the Internet by users in general, for this case we can consider the Azure App Service resource to fulfill this purpose.

In this tutorial article we can see that process: [.NET 5: Deploying Web Applications with Azure App Service](https://dev.to/esdanielgomez/net-5-deploying-web-apps-with-azure-app-service-5349).

##**Thank you very much** ##

Thank you very much for reading, I hope this demo can be of use to you. If you have any questions or ideas that you need to discuss, it will be nice to be able to collaborate and together exchange knowledge with each other.

If you like, we can stay in touch on [Facebook](https://www.facebook.com/esDanielGomez), on [Twitter](https://twitter.com/esDanielGomez), or in [Telegram](https://t.me/esdanielgomez) too. :)