Guide To Organizing And Promoting Events Through A Web Portal With ASP.NET 5

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,
 
 
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:

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:

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.
 
 
The first thing we have to do is set this database, for this, the SQL script can be found here,
  1. -- -----------------------------------------------------  
  2. CREATE TABLE  Event (  
  3.   IdEvent INT NOT NULL IDENTITY(1,1),  
  4.   Name VARCHAR(45) NOT NULL,  
  5.   Description VARCHAR(500) NULL,  
  6.   Icon VARCHAR(45) NULL,  
  7.   StartDate DATETIME NOT NULL,  
  8.   EndDate DATETIME NOT NULL,  
  9.   RegistrationLink VARCHAR(45) NULL,  
  10.   StreamingLink VARCHAR(45) NULL,  
  11.   PRIMARY KEY (IdEvent))  
  12. ;  
  13.   
  14. -- -----------------------------------------------------  
  15. CREATE TABLE  Speaker (  
  16.   IdSpeaker INT NOT NULL IDENTITY(1,1),  
  17.   FirstName VARCHAR(45) NOT NULL,  
  18.   SecondName VARCHAR(45) NULL,  
  19.   FirstLastName VARCHAR(45) NOT NULL,  
  20.   SecondLastName VARCHAR(45) NULL,  
  21.   PhotoLink VARCHAR(45) NULL,  
  22.   TwitterLink VARCHAR(45) NULL,  
  23.   LinkedInLink VARCHAR(45) NULL,  
  24.   IdEvent INT NOT NULL,  
  25.   PRIMARY KEY (IdSpeaker),  
  26.   INDEX fk_Speaker_Event_idx (IdEvent ASC),  
  27.   CONSTRAINT fk_Speaker_Event  
  28.     FOREIGN KEY (IdEvent)  
  29.     REFERENCES Event (IdEvent)  
  30.     ON DELETE NO ACTION  
  31.     ON UPDATE NO ACTION)  
  32. ;  
  33.   
  34. -- -----------------------------------------------------  
  35. CREATE TABLE  SessionType (  
  36.   IdSessionType INT NOT NULL IDENTITY(1,1),  
  37.   Name VARCHAR(45) NOT NULL,  
  38.   Description VARCHAR(45) NULL,  
  39.   PRIMARY KEY (IdSessionType))  
  40. ;  
  41.   
  42. -- -----------------------------------------------------  
  43. CREATE TABLE  SessionLevel (  
  44.   IdSessionLevel INT NOT NULL IDENTITY(1,1),  
  45.   Name VARCHAR(45) NULL,  
  46.   Description VARCHAR(45) NULL,  
  47.   PRIMARY KEY (IdSessionLevel))  
  48. ;  
  49.   
  50. -- -----------------------------------------------------  
  51. CREATE TABLE  Session (  
  52.   IdSession INT NOT NULL IDENTITY(1,1),  
  53.   Name VARCHAR(45) NOT NULL,  
  54.   Description VARCHAR(500) NULL,  
  55.   StartDate DATETIME NULL,  
  56.   EndDate DATETIME NULL,  
  57.   IconLink VARCHAR(45) NULL,  
  58.   IdSessionType INT NOT NULL,  
  59.   IdSessionLevel INT NOT NULL,  
  60.   PRIMARY KEY (IdSession),  
  61.   INDEX fk_Session_SessionType1_idx (IdSessionType ASC),  
  62.   INDEX fk_Session_SessionLevel1_idx (IdSessionLevel ASC),  
  63.   CONSTRAINT fk_Session_SessionType1  
  64.     FOREIGN KEY (IdSessionType)  
  65.     REFERENCES SessionType (IdSessionType)  
  66.     ON DELETE NO ACTION  
  67.     ON UPDATE NO ACTION,  
  68.   CONSTRAINT fk_Session_SessionLevel1  
  69.     FOREIGN KEY (IdSessionLevel)  
  70.     REFERENCES SessionLevel (IdSessionLevel)  
  71.     ON DELETE NO ACTION  
  72.     ON UPDATE NO ACTION)  
  73. ;  
  74.   
  75. -- -----------------------------------------------------  
  76. CREATE TABLE  Speaker_has_Session (  
  77.   IdSpeaker INT NOT NULL,  
  78.   IdSession INT NOT NULL,  
  79.   INDEX fk_Speaker_has_Session_Session1_idx (IdSession ASC),  
  80.   INDEX fk_Speaker_has_Session_Speaker1_idx (IdSpeaker ASC),  
  81.   CONSTRAINT fk_Speaker_has_Session_Speaker1  
  82.     FOREIGN KEY (IdSpeaker)  
  83.     REFERENCES Speaker (IdSpeaker)  
  84.     ON DELETE NO ACTION  
  85.     ON UPDATE NO ACTION,  
  86.   CONSTRAINT fk_Speaker_has_Session_Session1  
  87.     FOREIGN KEY (IdSession)  
  88.     REFERENCES Session (IdSession)  
  89.     ON DELETE NO ACTION  
  90.     ON UPDATE NO ACTION)  
  91. ;  
  92.   
  93. -- -----------------------------------------------------  
  94. CREATE TABLE  Organizer (  
  95.   IdOrganizer INT NOT NULL IDENTITY(1,1),  
  96.   Name VARCHAR(45) NOT NULL,  
  97.   LogoLink VARCHAR(45) NULL,  
  98.   WebPage VARCHAR(45) NULL,  
  99.   Email VARCHAR(45) NULL,  
  100.   Description VARCHAR(45) NULL,  
  101.   FacebookLink VARCHAR(45) NULL,  
  102.   TwitterLink VARCHAR(45) NULL,  
  103.   InstagramLink VARCHAR(45) NULL,  
  104.   IdEvent INT NOT NULL,  
  105.   PRIMARY KEY (IdOrganizer),  
  106.   INDEX fk_Organizer_Event1_idx (IdEvent ASC),  
  107.   CONSTRAINT fk_Organizer_Event1  
  108.     FOREIGN KEY (IdEvent)  
  109.     REFERENCES Event (IdEvent)  
  110.     ON DELETE NO ACTION  
  111.     ON UPDATE NO ACTION)  
  112. ;  
  113.   
  114. -- -----------------------------------------------------  
  115. CREATE TABLE  Sponsor (  
  116.   IdSponsor INT NOT NULL IDENTITY(1,1),  
  117.   Name VARCHAR(45) NOT NULL,  
  118.   LogoLink VARCHAR(45) NULL,  
  119.   Description VARCHAR(45) NULL,  
  120.   WebPage VARCHAR(45) NULL,  
  121.   IdEvent INT NOT NULL,  
  122.   PRIMARY KEY (IdSponsor),  
  123.   INDEX fk_Sponsor_Event1_idx (IdEvent ASC),  
  124.   CONSTRAINT fk_Sponsor_Event1  
  125.     FOREIGN KEY (IdEvent)  
  126.     REFERENCES Event (IdEvent)  
  127.     ON DELETE NO ACTION  
  128.     ON UPDATE NO ACTION)  
  129. ;  
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.
 

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.
 
And in Visual Studio 2019 we can visualize something like this for the EventAdmin and EventPortal projects respectively,
 
 
 
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. 
  1. public class EventId  
  2. {  
  3.     private static EventId instance { getset; } = null;  
  4.   
  5.     public int Id { getset; } = 1;  
  6.   
  7.     private EventId() { }  
  8.   
  9.     public static EventId GetInstance()  
  10.     {  
  11.         if (instance == null) {  
  12.             instance = new EventId();  
  13.         }  
  14.   
  15.         return instance;  
  16.     }  
  17. }  

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,
 
 
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,
 
 
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.
 
 
The structure in Visual Studio 2019 is as this,
 
 
In which, the general structure of the website is located in the MasterPage.dotmaster,
 
 
And the content of the page, defined by the ContentPlaceHolder control with the identifier MainContent, is located in the Default.dothtml.
 
 
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.
  1. public List<SponsorModel> Sponsors { getset; }  
  2. public List<OrganizerModel> Organizers { getset; }  
  3. public List<CalendarSpeakers> Calendar { getset; } = new List<CalendarSpeakers>();  
  4.   
  5. public EventModel Event { getset; }  

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.
 
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, on Twitter, or in Telegram too. :)


Similar Articles