ASP.NET Core MVC(.NET6) CRUD Operations using EntityFrameworkCore

MVC stands for Model-View-Controller, it’s a software architectural pattern that separates an application into three main components: Model, View and Controller. The Model represents the data and business logic of the application, the View is responsible for rendering the data into a user interface and the Controller handles user interactions and updates the Model accordingly.

Step-1 Open Visual Studio and click on Create New Project

Step-2 Select ASP.NET Core Web App (Model-View-Controller) and click next button

Step-3 Enter the project name and click on next button

Step-4 Select .Net 6.0 , authentication type None and click on create button

Step-5 Open Models folder and create a Employee class

Enter the following code in the student class

Step-6 Install the following packages according to your .NET Core version

Step-7 Create a subclass ApplicationDbContext of DBContext Class to link the database with data model class

A. Create one folder and name it Data

B. Create ApplicaitonDbContext class and enter the following code

In the above code we are passing parameter DbContextOptions<ApplicationDbContext> using constructor, Using this we are passing context configuration from AddDbContext to DbContext

Step-8 Open appsettings.json and configure the connection string

Step-9 Open the program.cs file and add the required services

A. Register ApplicationDbContext subclass as scoped service in application service provider / dependency injection container.

B. Enter the following lines of code to register the ApplicaitonDbContext

Program.cs

Step-10 Run the migration

A. Open the package manager console

Type the following command to run the migration

add-migration ‘initial’

Migration file

Step-11 Run the following update command to update the database as per this migration file

update-database

Step-12 Add Employee Controller

A. Right click on Employee folder

B. Click on add

C. Click on controller

D. Select MVC Controller Empty and click on Add button

E. Enter the Controller name and press add button

Step-13 Paste the following code in your StudentControler.cs file

Step-14 Add view files

Create one Student folder under View folder and create the following files

A. Index.cshtml

B. Create.cshtml

C. Edit.cshtml

D. Delete.cshtml

Index.cshtml

@model IEnumerable<StudentInformation.Models.Studentcs>
<div class="container">
    <div class="row">
        <div class="col-8 offset-2 mb-2">
            <h1 class="text-center text-primary"><marquee>Student Record</marquee></h1>
            <div class="text-left">
            <a class="btn btn-outline-success text-left" asp-controller="Student" asp-action="Create">Create</a>
            </div>
        </div>
        <table class="table table-bordered">
            <tr class="text-center">
                <th>StudentId</th>
                <th>Name</th>
                <th>Standard</th>
                <th>Address</th>
                <th>Hobby</th>
                <th>Action</th>
            </tr>
            @foreach(var d in Model)
            {
                <tr class="text-center">
                <td>@d.Id</td>
                <td>@d.Name</td>
                <td>@d.Standard</td>
                <td>@d.Address</td>
                <td>@d.Hobby</td>
                <td>
                    <a class="btn btn-outline-primary"asp-controller="Student"asp-action="Edit"asp-route-id="@d.Id">Edit</a>
                    <a class="btn btn-outline-danger" asp-controller="Student"asp-action="Delete" asp-route-id="@d.Id" onclick="javascript: return CheckConfirm();">Delete</a>
                </td>
                </tr>
            }
        </table>
    </div>
</div>

Create.cshtml

@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@{
}
@model StudentInformation.Models.Studentcs

<div class="conatiner">
    <div class="row">
        <div class="col-6 offset-3">
            <div class="card">
                <div class="card-header">
                    <h1 class="text-center" text-primary>Add Student</h1>
                </div>

                <form method="post" asp-action="Create">
                    <div class="form-group">
                        <label asp-for="Name"></label>
                        <input type="text" asp-for="Name" class="form-control" placeholder="Enter student name">
                        <label asp-for="Standard"></label>
                        <input type="text" asp-for="Standard" class="form-control" placeholder="Enter student standard">
                        <label asp-for="Address"></label>
                        <input type="text" asp-for="Address" class="form-control" placeholder="Enter student address">
                        <label asp-for="Hobby"></label>
                        <input type="text" asp-for="Hobby" class="form-control" placeholder="Enter student hobby">
                    </div>
                    <div class="form-group">
                        <input type="submit" value="submit" class="btn btn-sm btn-outline-success floatright mt-2" />
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

Edit.cshtml


@model StudentInformation.Models.Studentcs
<div class="conatiner">
    <div class="row">
        <div class="col-6 offset-3">
            <div class="card">
                <div class="card-header">
                    <h1 class="text-center" text-primary>Edit Employee</h1>
                </div>

                <form method="post" asp-action="Edit">
                    <div class="form-group">
                        <label asp-for="Name"></label>
                        <input type="hidden" asp-for="Id"/>
                        <input type="text" asp-for="Name" class="form-control" placeholder="Enter student name">
                          <label asp-for="Standard"></label>
                         <input type="text" asp-for="Standard" class="form-control" placeholder="Enter student Standard">
                          <label asp-for="Address"></label>
                         <input type="text" asp-for="Address" class="form-control" placeholder="Enter student Address">
                           <label asp-for="Hobby"></label>
                         <input type="text" asp-for="Hobby" class="form-control" placeholder="Enter student Hobby">
                    </div>
                    <div class="form-group">
                        <input type="submit"value="submit"class="btn btn-sm btn-outline-success floatright" />
                    </div>
                </form>
            </div>
        </div>
    </div

Step-15 Finally run the app and test all functionalities

API & REST API

What is an API?

Api is short for Application Programming Interface. It is used in computer programs to communicate with other applications and/or services.
It acts as a bridge between different softwares and devices.
Each time we use an app like Facebook or Instagram, send an instant message or check the weather on our phone, we use nothing but an API.

Everything from sharing photos to shopping online, booking a cab, a flight or a hotel, playing games is all done via APIs.
It is API because the technology is innovating at a faster than the predicted rate.

If we look at the below diagram, which is a basic information flow diagram depicting the position of an Application Programming Interface in the whole schema of system integration.

Importance of API is –

When we search for nearby restaurants on any browser, it lays out their locations on Google Maps instead of creating separate maps.
Thus, via the Google Map API, the browser passes the information it wants – restaurant addresses, rating, timings, and a lot more –
to an internal Google Maps function that then returns a Map object with restaurant pins in it at the proper locations.
It allows programmers to create apps without having to learn how to code.

Take some examples –

So let’s take Instagram for example. When you open up Instagram, there’s this bar at the top of the screen where you can search through different hashtags or accounts. There’s also another bar at the bottom which has these buttons like “Follow”, “Like” etc. These are all links to third

Why Should You Use APIs?

It is easy to understand that APIs can allow different computer programs to share or request features, services, and other content.
Suppose you think that why different businesses are using APIs comes down to the range of benefits of APIs to consumers and providers.
The API consumers can request access to different server resources or automate different tasks internally.

Advantages of API –

The key advantages of APIs to consumers include improved operations, increased innovation, and improved customer satisfaction.
It is easy to unlock business opportunities and increase business revenue.

Rest API?

REST stands for Representational State Transfer.
So, REST means using HTTP (HyperText Transport Protocol) to transfer resources such as HTML documents, images, audio files,
A REST API is a web service (a server) which accepts requests from client applications using HTTP (HyperText Transfer Protocol).
The clients use a common protocol such as XML or JSON to send data to the server.
The server processes the request, generates a response and sends it back to the client.

Methods of Rest Api –

GET –

The GET method is used to retrieve resources from a server.
Example – HTTP GET ‘http://www.apidomain.com/users/123’

POST –

POST method is used to create a new resource into the collection of resources on a server.
Example – HTTP POST ‘http://www.apidomain.com/users’

PUT –

PUT is used to update the existing resource on the server and it updates the full resource.
Example – HTTP PUT ‘http://www.apidomain.com/users/123’

PATCH –

PATCH is used to update the existing resource on the server and it updates a portion of the resource.
Example – HTTP PATCH ‘http://www.apidomain.com/users/123’

DELETE –

DELETE Method is used to delete the resources from a server. It deletes resource identified by the Request-URI.

Creating a Web API Project

We need the following tools installed on our computer:

Open Visual Studio 2022 and select Create a new project and then select ASP.NET Core Web API:

and give a name to your project in the following screen and then click Next.

In the next screen, select .NET 6.0 as the framework and click Create:

At this point we have a starter project as follows:

In the Program.cs we see that Swagger support is added automatically to our project:

Now, let’s run (Ctlr+F5) the project to see the default output. When the browser opens and the Swagger UI is shown, select the GET method in the WeatherForecast part and then select Try It Out and Execute:

Also, you can use the curl URL shown in the Swagger UI for this method and see the result of the URL in the browser:

When we run the application, the default URL comes from the launchSettings.json:

And the result values come from the GET method of the WeatherForecastController:

As you see, values here are hard coded and randomness is added to generate different values.

In our Web API, we will create our own records in an SQL server database and will be able to view, update and delete them through REST API endpoints.

If you feel my blogs are useful then please share, follow and comment on it. Also, you can connect with me over linkedIn: https://www.linkedin.com/in/neeni-bharti-b64b9a252/

SQL SERVER

Introduction to SQL Server

Introduction to SQL Server

SQL Server is an application software for Relational Database Management System (RDBMS), from Microsoft back in 1988, We can used it for creating, maintaining, managing, and implementing relational databases.

It is actually a backend application that allows us to store and process data.

It is called the relational database management system due to its nature to store the data in tables where the tables store the data about the same entity.

HOW DOES SQL SERVER MAKES WORK SO EASY?

Being based on open source it is very easy to access and the vast majority of programmers working in web development have used Microsoft SQL Server in some of their projects.

It  supports various business intelligence operations, analytics operations, and transaction processing.

Download SQL Server 2019 Developer Edition!!!!

Step 1

Download installation media .

Step 2

Run the downloaded file and you will see the below screen. Now select the third option – Download Media.

 

Step 3

Now you will see the below screen. Please select the language you prefer and select the ISO radio button to download the ISO file. In addition, select the download location of your choice. I will go with the default location. Now press the Download button.

Step 4

Now it will start downloading SQL Server installation media. It will take some time based on your internet connection speed.

Step 5 After successful download of installation media, you will see the below screen. Click the Close button.

Install SQL Server 2019 Developer Edition!!!

Now that we have installation media, we can start the installation of the SQL Server. Let’s see how to install SQL Server step by step.

Step 1

Run install media file (ISO file) downloaded in above section by double-clicking on it. It will extract/mount all the contents in a new temporary drive.

Step 2

Once extraction is completed, double click on the setup.exe file and you will see the below screen. Click on the Installation option in the left panel and then click on New SQL Server stand-alone installation or add features to an existing installation option from the right panel.

Step 3

Now you will see the Product Key window. Select the Developer option from the dropdown and click on the Next button.

Step 4

Now you will see the License Terms window. Just select the checkbox and click on the Next button.

Step 5

Now you will see the Microsoft Update window. It is not compulsory to check for the latest updates but it is recommended. So, select the checkbox and click the Next button.

Step 6

Now it will check for updates and install them if any.

Step 7

After that, it will check some rules or prerequisites for the installation of SQL Server. Once all the rules passed, click on the Next button.

Step 8

On the Feature Selection window, select features as shown in the below screenshot. You can also change the location for SQL Server instance installation but I will go with the default location. After feature selection please click the Next button.

Step 9

It will check some feature rules/prerequisites and then you will see the Instance Configuration screen. Here you can choose between Default Instance and Named Instance. Here I will go with Named Instance.

Note

Default Instance

When SQL Server is installed in the default instance, it does not require a client to specify the name of the instance to make a connection. The client only has to know the server name. For example, UPASNA-PC.

Named Instance

A named instance is identified by the network name of the computer plus the instance you specify during the installation. The client must specify both the server name and the instance name when connecting. For example, UPASNA-PC/MSSQLSERVER.

Step 10

Next, you will see the Server Configuration window. In Service Accounts tab, select Automatic in Startup Type for SQL Server Agent, SQL Server Database Engine, and SQL Server Browser services.

Step 11

Next, you will see the Database Engine Configuration window. In the Server Configuration tab, choose Mixed Mode in the authentication mode section and enter a strong password. In Specify SQL Server administrators section, your current windows user should already be added automatically. If not, click on Add Current User button.

Step 12

Next, the setup will check some feature configuration rules, and then the Ready to Install window will appear. This window shows the summary of all the features and configurations which we have done in the above steps. Once review the summary and click on the Install button.

Step 13

Now, the installation will start and it may take some time based on our configurations.

Step 14

After installation, it will show you the list of features and their installation status. If any error occurred, it will show here.

Next, you can install SQL Server Management Studio to connect SQL Server and query SQL databases. Please follow below steps to install SQL Server Management Studio.

Install SQL Server Management Studio!!!!

Install SQL Server Management Studio

First, let us download SQL Server installation media from the official website.

Step 1

Download installation media.

Step 2

Below file will download.

Step 3

Run the downloaded file and you will see below screen. Just click on the Install button.

Step 4

It will start installing management studio. It will take some time.

Step 5

Once installation finished, close the installation wizard and open start menu and search for SQL Server Management Studio. You will see below application. Now, click on it to open the application.

Step 6

Next, you will see below screen. In Connect to Server window, you can see the SQL instance name, which we have just installed. (Ref. Step 9). You can connect an instance with either Windows Authentication or SQL Authentication, which we have created in Step 11.

Step 7

Once you successfully authenticated, you can see Object Explorer in which you can find database list and other SQL objects.

 

So, hope you understand how to install and connect SQL Server using SQL Server Management Studio.

SSMS Components..

SQL Server Management Studio has the following components:

  • Object Explorer
  • Security
  • Server Objects
  • Query and Text Editor
  • Template Explorer
  • Solution Explorer
  • Visual Database Tools

Object Explorer

Object Explorer contains different components of one or more instances of SQL Server in a hierarchical manner. You can view and manage components such as Databases, Security, Server Objects, Replication, Management, etc.

Security

Managing security for your database server is extremely important. The Security node is below the Databases node in the Object Explorer. You can create Logins and assign Server roles for any database instance. In addition, you can assign role-based security to logins and users. The Server roles you create here have server-wide scope.

Server Objects

The Server Objects node in SSMS has four sub-nodes: Backup devices, Endpoint’s, Linked Servers, and Triggers. A linked server is a method by which a SQL Server can talk to another ODBC database with a T-SQL statement. SQL Server Endpoint’s are a point of entry into SQL Server. It is a database object that defines a way in which the SQL Server can communicate over the network. All objects under Server Objects have server-wide scope.

Replication

Replication is a set of technologies for copying and distributing data and database objects between databases and synchronizing databases. This is mainly used for maintaining consistency between databases.

Polybase

Polybase allows your SQL Server to query directly from other SQL Server, Oracle, MongoDB, Hadoop clusters, Teradata, Cosmos DB by installing client connection software using T-SQL separately. Polybase is used for data virtualization.

Query and Text Editor

Open a query editor by clicking on the New Query on the tool bar. Query editor lets you create, edit & execute Transact SQL (T-SQL) statements. It is equipped with IntelliSense support by auto-completing the script by suggesting variants. This makes writing & debugging code easier and faster.

Template Explorer

Template explorer provides templates for creating various database objects. You can browse the available templates in Template Explorer and open it into a code editor window. You can also create your own custom templates.

Open Template Explorer from View menu -> Template Explorer. The following displays Create Database template.

Solution Explorer

Solution explorer is used to manage administration items such as scripts and queries. Open it from View -> Solution Explorer menu.

Create Database in SQL Server 2019!!!!

In SQL Server, a database is made up of a collection of objects like tables, functions, stored procedures, views etc. Each instance of SQL Server can have one or more databases. SQL Server databases are stored in the file system as files.

Type of Database in SQL Server

There are two types of databases in SQL Server: System Database and User Database.

System databases are created automatically when SQL Server is installed. They are used by SSMS and other SQL Server APIs and tools, so it is not recommended to modify the system databases manually.

User-defined Databases are created by the database user using T-SQL or SSMS for your application data. A maximum of 32767 databases can be created in an SQL Server instance.

There are two ways to create a new user database in SQL Server:

  1. Create Database Using T-SQL
  2. Create Database Using SSMS

Create Database using SQL Server Management Studio….

Open SSMS and in Object Explorer, connect to the SQL Server instance. Expand the database server instance where you want to create a database.

Right-click on Databases folder and click on New Database.. menu option.

In New Database window, enter a name for the new database, as shown below. Let us enter the database name ‘HR’.  Every SQL Server database has at-least a minimum of two operating system files: Data file and Log file.

Click Ok to create a new ‘HR’ database. This will be listed in the database folder, as shown below.

In the above figure, the new ‘HR’ database is created with the following folders:

Database Diagrams: It graphically shows the structure of the database. You can create a new database diagrams by right-clicking on the folder and selecting Create New Diagram

Tables: All the system and user defined tables associated with the database are available under this folder. Tables contain all the data in a database.

Views: All the System and used defined views are available under this folder. System views are views that contain internal information about the database.

External Resources: Any Service, computer, fileshare, etc that are not a part of the SQL Server installation are stored here. Contains 2 folders 1) External Data Sources 2) External File Formats

Programmability: The Programmability folder lists all the Stored Procedures, Functions, Database Triggers, Assemblies, Rules, Types, Defaults, Sequences of the database

Service Broker: All database Services are stored in this folder

Storage: Stores information on Partition Schemes, Partition Functions, Full Text Catalogs,

Security: Database Users, Roles, Schemas, Asymmetric Keys, Certificates, Symmetric Keys, Security policies are created & available in the Security folder of every database.

Create Table using SSMS..

You can design a new table using the table designer in SQL Server Management Studio.

To design a new table, open SSMS and connect to your sql server instance.

In Object Explorer, expand the HR database or the database where you want to create a new table.

Now, right-click on the Tables folder and select New Table, as shown below.

Create Table

This will open a table designer where you can enter a name of a column, its data type, and check the checkbox if a column allows null, as shown below.

Create Table in SQL Server

Column Name: Type a unique column name.

Data type: Choose a data type for the column from the dropdown list. Choose the appropriate length for the string data types.

Allow Nulls: Choose whether to allow Nulls for each column by check the check-box.

Enter columns info in a separate row for all the columns you want to take in your table. The followings are columns of the Employee table.

To set the properties for a column, such as identity specification, computed column specification, etc., select a column and set the property value in the Column Properties tab in the bottom pane.

To specify a column as a primary key column, right-click on the column row and select Set Primary Key, as shown below.

Create Table in SQL Server

You can configure the primary key that will auto generate unique integers by setting it as identity column, as shown below.

Create Table in SQL Server

By default, the table is created in the dbo schema. To specify a different schema for the table, right-click in the Table-Designer pane and select properties. From the Schema drop-down list, select the appropriate schema.

Create Table in SQL Server

Now, from the file menu, choose Save to create this table. Enter Employee as a table name and click OK.

Create Table in SQL Server

To view the new table, refresh the Tables folder in the Object Explorer. The EMPLOYEE table is now available under the Tables node.

Add Columns Using SSMS:

In Object explorer, right-click the table to which you want to add new columns and choose Design.

Click the first blank cell under the last column name column and enter the name of the column, as shown below.

In the next column, select the data type from the dropdown and the length if applicable.

In the last column of a row, check Allow Nulls checkbox if it is nullable. Now, save the table from file -> Save menu to save the modified table.

Rename Table and Columns Using SSMS:

Open SSMS and expand the database folder.

Select and right-click on a table or a column you want to rename and click Rename. Enter a new name by over writing on existing name.

Go to the file menu and click Save.

Delete Columns Using SSMS

Open SSMS and connect to the SQL Server instance. In Object explorer, expand the database and the Tables folder. Locate the table and expand the columns folder to display the column names.

Right-click on the column name which you want to delete and click delete.

This will open “Delete Object” page, as shown below.

Click OK to delete a column.

Finally, save the changes from File menu -> Save.

Create a Foreign Key using SSMS..

What is Foreign Key?

The foreign key establishes the relationship between the two tables and enforces referential integrity in the SQL Server. For example, the following Employee table has a foreign key column DepartmentID that links to a primary key column of the Department table.

Here, we will configure the DepartmentID column as a foreign key in the Employee table that points to the DepartmentID PK column of the Department table using SQL SERVER MANAGEMENT STUDIO.

Open SSMS and expand the HR database. Right-click on the Employee table and click on the Design option, as shown below.

This will open the Employee table in the design mode.

Now, right-click anywhere on the table designer and select Relationships…, as shown below.

This will open the Foreign Key Relationships dialog box, as shown below.

Now, click on the Add button to configure a new foreign key, as shown below.

Now, to configure the primary key and foreign key relationship, click on the Tables and Column Specification […] button. This will open Tables and Columns dialog box where you can select primary key and foreign key relationship.

Here, we are configuring the DepartmentID column in the Employee table as a foreign key, which points to the primary key column DepartmentID of the Department table. So, select primary table and key in the left side and foreign key table and column in the right side, as shown below.

The following defines a foreign key DepartmentID in the Employee table.

Click OK to create the relationship and click on Close to close the dialog box.

Now, save your changes. This will create a one-to-many relationship between the Employee and Department table by setting a foreign key on the DepartmentID column in the Employee table, as shown below.

IF YOU FIND MY BLOG USEFUL,FOLLOW,SHARE AND COMMENT!

THANK YOU!

Razor Syntax

What it is and How to Use it?

Introduction:

It’s a great tool for developers who want to create dynamic HTML pages with minimal coding. In this blog post, we’ll take a look at what razor syntax is, how it works, and how you can use it in your own projects.

Razor syntax is essentially a shorthand way of writing code. It allows developers to write HTML and C# code together in the same page without having to switch between different languages. This helps simplify the development process and makes coding more efficient. Razor syntax was first introduced in 2011 with the release of ASP.NET MVC 3. Since then, it has become one of the most popular templating engines for Web development.

Razor syntax uses the “@” symbol to denote code blocks within an HTML page. For example, if you wanted to display an image on your website using razor syntax, you would write something like this: @<img src=”image-url” /> This tells the server to display an image with the specified URL on the page when it renders it as HTML. 

In addition to displaying content from variables and other sources, razor syntax can also be used for more complex tasks such as looping through data collections or making decisions based on conditions (if/else statements). This makes it possible for developers to create highly dynamic pages that can adapt easily depending on user input or other external factors.

How Can You Use Razor Syntax?

If you’re looking to get started with razor syntax, you’ll need a few things first—namely a web framework like ASP.NET MVC or ASP.NET Core and some knowledge of programming languages like C# or Visual Basic .NET (VB .NET). Once you have those two things taken care of, you can start writing your own razor syntax code. 

Razor syntax is a powerful templating engine that enables developers to quickly create dynamic HTML pages with minimal coding effort required. It’s simple yet powerful design makes it ideal for projects of all sizes from small personal websites all the way up to large corporate applications – so no matter what type of project you’re working on, it’s worth considering giving razor syntax a try. With just some basic programming knowledge and experience under your belt, you’ll be able to write razor code confidently in no time at all!

Important points about Razor:

Intellisense: Razor syntax supports statement completion within visual studio.

Easy to Differentiate: Easily you differentiate server side code from html code.

Compact: Razor syntax is compact, enabling you to minimize the number of characters and keystrokes required to write code.

Creating a View Using Razor:

Let’s create a new ASP.Net MVC project.

Enter the name of project in the name field and click Ok.

Select the MVC 5 Controller – Empty option and click Add button and then the Add Controller dialog will appear.

Set the name to HomeController and click ‘Add’ button. You will see a new C# file ‘HomeController.cs’ in the Controllers folder, which is open for editing in Visual Studio as well.

Right-click on the Index action and select Add View…

To keep things simple, select the Empty option and check the MVC checkbox in the ‘Add folders and core references for’ section and click Ok. It will create a basic MVC project with minimal predefined content.

Once the project is created by Visual Studio, you will see a number of files and folders displayed in the Solution Explorer window. As we have created ASP.Net MVC project from an empty project template, so at the moment the application does not contain anything to run. Since we start with an empty application and don’t even have a single controller, let’s add a HomeController.

To add a controller right-click on the controller folder in the solution explorer and select Add → Controller. It will display the Add Scaffold dialog.

Select Empty from the Template dropdown and click Add button. Visual Studio will create an Index.cshtml file inside the View/Home folder.

Notice that Razor view has a cshtml extension. If you’re building your MVC application using Visual Basic it will be a VBHTML extension. At the top of this file is a code block that is explicitly setting this Layout property to null.

When you run this application you will see the blank webpage because we have created a View from an Empty template.

Let’s add some C# code to make things more interesting. To write some C# code inside a Razor view, the first thing we will do is type the ‘@’ symbol that tells the parser that it is going to be doing something in code.

Let’s create a FOR loop specify ‘@i’ inside the curly braces, which is essentially telling Razor to put the value of i.

      Run this application and you will see the following output

Razor Syntax,.NET Framework and ASP.NET:

The Razor syntax gives you all the power of ASP.NET, but using a simplified syntax that’s easier to learn if you’re a beginner and that makes you more productive if you’re an expert. Even though this syntax is simple to use, its family relationship to ASP.NET and the .NET Framework means that as your websites become more sophisticated, you have the power of the larger frameworks available to you.

IF YOU FIND MY BLOG USEFUL COMMENT & SHARE.
THANK YOU!

IMPORTANCE OF CHOOSING BEST ARCHITECTURE

Software architecture comes under design phase of software development life cycle. It is one of initial step of whole software development process. Without software architecture proceeding to software development is like building a house without designing architecture of house.

So software architecture is one of important part of software application development.

When we are building web or software applications, we constantly look for ways to improve our code and use better tools to get the best experience, performance, and many other things, not just on the final client-side but also in the development and deployment process.

we discuss Monolithic architecture ,Microservices and Modular Monolithic Architecture.

MONOLITHIC ARCHITECTURE

A monolith application is the one where the application is a single unit, which means that all the  logic is in one place and if a change is applied to the application, it affects the whole application and needs to be fully deployed again to include the changes working in the production server. Also, this kind of application usually uses only one type of database and one programming language for development.

MONOLITHIC ARCHITECTURE

MICROSERVICES

An application built using the microservices architecture is one where the whole application is divided into different pieces of software, each independent of the other, using different programming languages, libraries and frameworks, and even different databases. The changes applied to one of these pieces don’t affect the others, making the development process more flexible.

  • Services are completely independent; each one has its own dependencies and logic.
  • Each service could have a different database (this is optional because they can share the same database, but it’s preferred).
  • Each service can use a different programming language and technology.
  • When there is a change in the code, you can deploy only one service without interrupting or affecting the others.
  • More scalable .
MICROSERVICES

MODULAR MONOLITHIC ARCHITECTURE

Modular Monolith Architecture is a software design in which a monolith is made better and modular with importance to re-use components/modules. It’s often quite easy to transition from a Monolith Architecture to Modular Monolith. The modular monolithic architecture consists of dividing our logic first into modules, and each module will be independent and isolated. Then, each module should have its own business logic — and, if necessary, its database or schema. In that way you can build and modify the layers of each module without affecting the others.

Communication must be done  between the modules through public APIs, allowing access to the logic of each module from the other using public methods, and not using the internal functions and logic of each one.

  • Modules are interchangeable.
  • Code is reusable.
  • Better organization of the dependencies compared to traditional monolithic apps.
  • Easier to maintain and develop new versions than traditional monolithic apps.
  • You can keep the whole project as a single unit, without needing different servers for deployment.
MODULAR MONOLITHIC ARCHITECTURE

Integrating Intelligence will be the Key to HR’S Future Relevance and Success

As the world of work continues to evolve, the role of Human Resources Management is becoming increasingly important. From managing a diverse and flexible workforce to promoting employee wellness and engagement, HR is at the forefront of shaping the way that organizations operate. At the same time, the integration of technology and artificial intelligence into HR is changing the way that HR is managed, presenting both opportunities and challenges.

Technology is critical for HR:

As technology continues to develop at a rapid pace, it is crucial for HR professionals to stay abreast of the latest trends and developments in the field. The future of human resource departments is likely to involve a greater emphasis on technology, data analysis, and strategic decision-making. Human Resources, in particular, have become a technologically advanced sector, one that is increasingly streamlined and working smarter. The following lines aim to provide an overview of the future of HR, examining the key trends that are shaping the field and the challenges and opportunities that these trends may present for HR professionals as they navigate the complex and rapidly changing world of work.

HUMAN +TECHNOLOGY= SUPERIOR COMPETITIVE EDGE

The Impact of Artificial Intelligence on HR:

As AI becomes more prevalent in the workplace, it will be important to understand how it is changing the way that HR is managed. This will enable HR departments to automate and streamline HR tasks such as recruiting, on-boarding, and performance management, as well as to analyze data to drive decision-making and measure the effectiveness of HR programs. Additionally, there may be an increased focus on employee engagement and retention, as well as on developing the skills and capabilities of employees
Another trend that is likely to shape the future of AI in HR is the increasing use of virtual assistants and chatbots. These technologies can be used to assist employees HR-related questions and tasks with more convenient and efficient access, freeing up HR professionals to focus on more strategic and value-added activities.

Where in HR has AI actually been deployed?

AI in Human Resources (HR) is typically deployed in the following area:

  • Recruitment and Hiring: AI-powered tools can be used to screen resumes, conduct initial interviews, and even predict which candidates will be the best fit for the company, this is known as AI-assisted recruiting. AI can help companies find the right talent at the right time.
  • Training and development: AI-powered tools can be used to personalize training and development programs optimize learning administration, and encourage collaborative learning for each employee, based on their skills and career goals, this is known as Learning management systems (LMS). Employees from different departments should learn together and exchange knowledge, and AI can help them pair up.
  • Performance management: AI can be used to monitor employee performance, providing managers with real-time feedback and helping them to identify patterns and trends that can help improve the overall performance of the organization. AI can also be used to optimize the setting of goals and the tracking of progress, by analyzing data and making recommendations based on the individual needs of the company and the employees.
  • Compensation and benefits: AI algorithms can be used to analyze data on employee performance and skills, and to make recommendations for appropriate levels of compensation and benefits. AI can also be used to optimize the design of benefit plans, by analyzing data and identifying the most effective options for the organization.
  • Employee retention: AI algorithms can be used to identify employees who may be at risk of leaving the company and to develop strategies to retain them, this is known as Employee retention AI.
  • Diversity and inclusion: AI algorithms can be used to identify and address unconscious bias in recruitment and hiring, as well as in performance evaluations and other HR processes. Diversity, equity and inclusion will play an even more prominent role in the future of HR.

Will AI Replace HR professionals?
Nothing can replace humans – and most times, even one human cannot replace the other. Therefore, saying that AI can replace HR professionals goes in vain. Undoubtedly, there are many benefits of accommodating Artificial Intelligence in the HR technology ecosystem to make the HR process easy. Still, it goes beyond words when it’s said that humans are necessary to make the final decision. In essence, AI is also the work of a human, where a human puts in the data, and the information is later collected by a human.

Conclusion:
The evolution of AI has gone a long and thorny path. However, its development resulted in beneficial AI implementation in our daily life. AI is becoming increasingly integrated into the field of Human Resources, and can be used to improve many aspects of the HR process.
It is evident that the role of HRM in the future will be of vital importance. As the nature of work continues to change, HR professionals will be instrumental in assisting organizations in adapting to new challenges and navigating the evolving landscape. It will be important for HR professionals to understand how it is changing the way that HR is managed. This includes tasks such as attracting and retaining top talent, fostering diversity and inclusion, and implementing employee engagement and retention strategies. HR professionals will be vital in ensuring that businesses have the necessary human capital to thrive in the future. Therefore, it is essential for companies to invest in the development of their HR professionals and ensure that they possess the skills and knowledge required to successfully address future challenges.

“Combined efforts can turn into happy workplace.”

As human resource professional, my experience teaches me that combined efforts of employers and employees are the foundation of best workplace. The key role of organizations is to support employees in a way that they become inspired to work together as in a productive zone: highly engaged and committed to their work and their purpose, while mastering their abilities as a professional.

Every employer wants to make their company the best place to work and every employee wants to work for their dream company. However, many people do not fully understand that creating a positive work environment and making a company a great place to work is a combined effort of both employers and employees. Unless there is a combined effort towards this mutual objective, we shall not succeed.

Employer and employee both are equally responsible for achieving the organization goals. As many positive efforts you do, the better effect it will have, even if we don’t realize it. We should strive to create positive, measurable and powerful outcomes. More efforts will make people take notice of your deeds and inspire them too.

Employee can add value to their organization by focusing on several key areas listed below:

• Committed to their work: Dedication, hard work, show up on time, meet deadlines, and follow through on commitments. This will demonstrate your level of enthusiasm towards the task assigned to your employer that you are a responsible and reliable employee.
• Be a problem solver: Being able to find ways to solve problems demonstrates initiative and enable the company to achieve more or meet deadlines faster will give the company a competitive edge. Instead of complaining about the problem with a product or service, spend that time trying to come up with a solution.
• Build healthy connections: Develop strong relationships with your colleagues, superiors, and clients. This can help improve communication, collaboration, and teamwork within the organization.
• Set clear expectation: Be familiar with your goals, targets and about a plan. It will provide a clear direction and plan-of-action for your work. This will create fewer problems as you will be very clear about your goals, you will be focused and will decipher what you exactly need to do.
• Self growth: Developing new skills, behaviors, actions, attitudes, habits and seeks out opportunities to learn new skills. This will make you a more valuable and versatile employee and can lead to promotions and career advancement.
• Active engagement: Active role in you work may help you learn more from your colleagues, superiors. This helps you learn more about their experiences and concerns so that you’re able to meet needs efficiently and effectively. Being willing to contribute to the success of your organization, you can add value and become an asset to your company.

Similarly, an employer can add value to their organization in following ways:

• Prioritize a work life balance: Ensuring that employees have a healthy and balanced work-life balance at workplace that reduce stress, prevent burnout and promote a considerate company culture.
• Offer good compensation packages: Employees are more likely to be attracted to and stay with an organization that offers competitive or industry-leading compensation packages. It is a great way to ensure employees feel satisfied and valued.
• Invest in their professional development: Providing employees with opportunities for continuous learning, skill-building, and competency development. Employers can offer training and development programs, as well as support employees in pursuing professional certifications and degrees.
• Create positive employee experiences: Cherish employee dedication to bridge by recognizing and rewarding them. Employers can create a positive culture by promoting transparency, openness, recognizing and rewarding employees, and fostering a sense of community within the organization.

Employer by focusing on these areas, can improve their ability to attract and retain top talent, leading to a more successful and sustainable organization.

To summarize both employer and employee should realize that creating a best place to work is not a one-sided effort. Both employers and employees efforts play an important role in creating an amazing, positive and strong work culture. By working together, employers and employees can create a work environment that is rewarding, fulfilling, motivating and beneficial for everyone.

Pay-cuts and Job-cuts are on the horizon

Business world is shaking. Recession is coming. Funding is drying. Companies are executing layoffs. Organizations are entering into cost cutting mode.

Tech sector is tightening its belt, it is expected to get a little tighter in the next year. To protect the business’s finances from the effects of the economic crisis, Companies are adopting this unavoidable but harsh action. Therefore, if the current trend is maintained, there will unavoidably be significant layoffs in the corporate sector in 2023. These are a few businesses where layoffs may still occur in 2023.

  1. Meta, one of the main big-tech businesses, sacked 11,000 employees or around 13% of its workforce.
  2. Twitter owned by musk has already lost a major mass of its workforce and going by his statements it abundantly clear that there would be additional mass layoffs lasting until 2023.
  3. Netflix, after cutting down its employees by 300 in June, it went for 150 more job cuts claiming to make adjustments in line with the revenue costs. In February it lost around 20,000 subscribers at the beginning of 2022 and is expecting a further decline in its audience base.
  4. Microsoft laid off 1800 employees in July, 200 employees in August, and a staggering 1,000 more recently as part of the realignment, according to Axios reports. If the economic condition worsens in 2023, it may lay off more employees.
  5. Better, having started trimming its workforce in 2021, by relieving 900 employees, in April this year, relieved another 1,200 to 1,500 employees and 3,100 more working in India and US in the next few months. As TechCrunch reports, it is expected to lay off 250 or more employees in the coming months.

Layoffs by Giant companies due to upcoming recession creates a fearing environment for the employees and somehow its ripple effect will soon be seen in the market where securing a job would be difficult and specifically for freshers or new bee’s to find a job in their dream companies. However, some organizations look at it from different perspective and consider it as finding an opportunity in disguise to hire the experienced candidates laid off from these Giant’s. Sooner lor later tech industry will evident such slowdowns.

Remembering the 2008 recession – according to a govt. study Five lakh people were rendered jobless between October to December 2008 due to the recession. More details here – https://www.livemint.com/Politics/OoYZchTpy5cZRVYNrJeHfP/500000-jobs-lost-to-recession-in-three-months-study.html

Glimpse of Mega Job fair attended by Zonixsoft

A mega Job fair organized on 25 th November 2022 by Skill Development Department in collaboration with Desh Bhagat University (DBU), Mandi Gobindgarh Punjab at Government Polytechnic Bikram Chowk, Jammu.

About 5000 candidates registered themselves through online and offline mode while around 25 reputed Multi-National, National and Local companies and Industries participated to hire the candidates.

Zonixsoft also attended the mega Job fair. The students were apprised about the company work environment, culture, the selection process and various opportunities offered. Among all the brilliant candidates we have selected 7 candidates who match our expectations. All in all a great day full of experiences and learnings.