Assignment 1
Notes:
• You can use you own design; screenshots are only for
clarity.
• Use Asp.Net MVC or Asp.Net Core with MVC architecture to build
the assignment. • Use Entity Framework to access database.
• Use the
bootstrap for design UI
• Need to implement Insert/Display List/Edit and Delete
functionality for the company. • Design all the related database tables in the
database and make the relationship.
1) Create a Company Registraon form in including the below form
fields
Note:
a) Please
apply the proper validaons
b) Email
Address should be unique
c) Password policy should be
strong, it should have at least 1 upper character, 1 lower character, 1 digit.
Password should have minimum length of 8 characters.
2) Create Country and State table in database and enter data
manually. No need to UI form. 3) Display the registered company
details in the JQuery Datatable Grid.
4) Edit the Company details accept the Email and Password.
5) Delete company record, before delete the record it should
display the confirmaon message like “Are you sure you want to delete this
record?” If Yes, then record will get deleted. If No, then popup will close.
Like below confirmaon message.
Addional Notes: If you finished the above
assignment and have some more me then you can implement the below addional
features as well.
a) You can filter the State based on the
Country. You can use AJAX to fier the State dropdown based on Country selecon.
b) Implement the funcon to send the email to aer successful
registraon.
Step1)open
mvc core project(name=Form1)
Step2)add DI
1.
C:\Users\Kiran\.nuget\packages\microsoft.entityframeworkcore\5.0.0\
2.
C:\Users\Kiran\.nuget\packages\microsoft.entityframeworkcore.design\5.0.0\
3.
C:\Users\Kiran\.nuget\packages\microsoft.entityframeworkcore.sqlserver\5.0.0\
4.
C:\Users\Kiran\.nuget\packages\microsoft.entityframeworkcore.tools\5.0.0\
5.
C:\Users\Kiran\.nuget\packages\microsoft.extensions.configuration.json\5.0.0\
6.
C:\Users\Kiran\.nuget\packages\microsoft.visualstudio.web.codegeneration.design\5.0.2\
Step3)Make poco class(right click on model)
I)add Registration class
using System;
using
System.Collections.Generic;
using
System.ComponentModel.DataAnnotations;
using
System.Linq;
using System.Threading.Tasks;
namespace Form1.Models
{
public class Registration
{
public int Id { get; set; }
[Required]
public string
CompanyName { get; set; }
public int Country
{ get; set; }
public int State { get; set; }
public string
AddressLine { get; set; }
public string ZipCode
{ get; set; }
[DataType(DataType.PhoneNumber)]
public string
PhoneNumber { get; set; }
[Required(ErrorMessage = "Email is required")]
[StringLength(16, ErrorMessage = "Must be between 5 and 50 characters", MinimumLength = 5)]
[RegularExpression("^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$", ErrorMessage = "Must be a valid
email")]
public string Email { get; set; }
[Required(ErrorMessage = "Username is required")]
[StringLength(16, ErrorMessage = "Must be between 3 and 16 characters", MinimumLength = 3)]
public string UserName
{ get; set; }
[Required(ErrorMessage = "Password is required")]
[StringLength(255, ErrorMessage = "Must be between 5 and 255 characters", MinimumLength = 5)]
[DataType(DataType.Password)]
public string Password
{ get; set; }
[Required(ErrorMessage = "Confirm Password is required")]
[StringLength(255, ErrorMessage = "Must be between 5 and 255 characters", MinimumLength = 5)]
[DataType(DataType.Password)]
[Compare("Password")]
public string
ConfirmPassword { get; set; }
[Display(Name = "You Have Read and agree to the Terms of Use")]
public bool
MustCheck { get; set; }
public Country Countrys { get; set; }
public State States { get; set; }
}
}
ii)add Country class
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Threading.Tasks;
namespace Form1.Models
{
public class Country
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<Registration> Registrations { get; set; }
}
}
iii)add state class
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Threading.Tasks;
namespace Form1.Models
{
public class State
{
public int Id { get; set; }
public string Name { get; set; }
public ICollection<Registration> Registrations { get; set; }
}
}
Step4)make Ef folder for
EfContext
using
Form1.Models;
using Microsoft.EntityFrameworkCore;
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Threading.Tasks;
namespace Form1.Ef
{
public class EfContext:DbContext
{
public EfContext(DbContextOptions<EfContext> options):base(options)
{
}
public DbSet<Country> Countries { get; set; }
public DbSet<State> States { get; set; }
public DbSet<Registration> Registrations { get; set; }
}
}
Step4)make Interfaces folder
i)add IRegistration interface
using
Form1.Models;
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Threading.Tasks;
namespace Form1.Interfaces
{
public interface IRegistration
{
public IList<Registration> GetAllR();
public Registration Add(Registration reg);
public Registration Edits(Registration reg);
public Registration Findd(int Id);
public Registration Delete(int Id);
}
}
ii)add ICountry interface
using
Form1.Models;
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Threading.Tasks;
namespace Form1.Interfaces
{
public interface ICountry
{
public IList<Country> GetCountries();
}
}
iii)add IState interface
using
Form1.Models;
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Threading.Tasks;
namespace Form1.Interfaces
{
public interface IState
{
public IList<State> GetState();
}
}
Step5)add Repository folder
i)add RegistrationRepository class
using
Form1.Ef;
using
Form1.Interfaces;
using
Form1.Models;
using System;
using
System.Collections.Generic;
using
System.Linq;
using System.Threading.Tasks;
namespace Form1.Repository
{
public class RegistrationRepository: IRegistration
{
EfContext Ef;
public RegistrationRepository(EfContext efContext)
{
Ef = efContext;
}
public IList<Registration> GetAllR()
{
return Ef.Registrations.ToList();
}
public Registration Add(Registration reg)
{
Ef.Registrations.Add(reg);
Ef.SaveChanges();
return reg;
}
public Registration Edits(Registration reg)
{
Ef.Entry<Registration>(reg).State =
Microsoft.EntityFrameworkCore.EntityState.Modified;
Ef.SaveChanges();
return reg;
}
public Registration Findd(int Id)
{
return Ef.Registrations.Find(Id);
}
public Registration Delete(int Id)
{
var ForDelete=Findd(Id);
Ef.Registrations.Remove(ForDelete);
Ef.SaveChanges();
return ForDelete;
}
//public
Registration FromGetById(int Id)
//{
// return Ef.Registrations.
//}
}
}
ii)add CountryRepository
using
Form1.Ef;
using
Form1.Interfaces;
using
Form1.Models;
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Threading.Tasks;
namespace Form1.Repository
{
public class CountryRepository:ICountry
{
EfContext Ef;
public CountryRepository(EfContext efContext)
{
Ef = efContext;
}
public IList<Country> GetCountries()
{
return Ef.Countries.Select(x => new Country()
{
Id = x.Id,
Name = x.Name
}).ToList();
}
}
}
ii)add StateRepository
using
Form1.Ef;
using
Form1.Interfaces;
using
Form1.Models;
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Threading.Tasks;
namespace Form1.Repository
{
public class StateRepository:IState
{
EfContext Ef;
public StateRepository(EfContext efContext)
{
Ef = efContext;
}
public IList<State> GetState()
{
return Ef.States.Select(x => new State()
{
Id = x.Id,
Name = x.Name
}).ToList();
}
}
}
Step6)add connecting string
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"ConnectionStrings": {
"From1": "Data Source=(localdb)\\ProjectsV13;Initial
Catalog=DBForm1;Integrated Security=True;"
},
"AllowedHosts": "*"
}
Step7)StartUp file
public void
ConfigureServices(IServiceCollection services)
{
services.AddControllersWithViews();
services.AddMvc();
services.AddDbContext<EfContext>(x => x.UseSqlServer(Configuration.GetConnectionString("From1")));
services.AddScoped<IRegistration, RegistrationRepository>();
services.AddScoped<ICountry,
CountryRepository>();
services.AddScoped<IState,
StateRepository>();
}
Step8)make
Migration
i)add-migration
abc
ii)Update-database
step9)add
controller(name=From1Controller)
using
Form1.Interfaces;
using
Form1.Models;
using
Microsoft.AspNetCore.Mvc;
using
Microsoft.AspNetCore.Mvc.Rendering;
using System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Threading.Tasks;
namespace Form1.Controllers
{
public class From1Controller : Controller
{
IRegistration Reg;
IState State;
ICountry Country;
public From1Controller(IRegistration Regs, IState States, ICountry Countrys)
{
Reg = Regs;
State = States;
Country = Countrys;
}
public IActionResult Index()
{
return View(Reg.GetAllR());
}
public IActionResult Index12()
{
return View(Reg.GetAllR());
}
public IActionResult Create()
{
ViewBag.Country = new SelectList(Country.GetCountries(), "Id", "Name");
ViewBag.State = new SelectList(State.GetState(), "Id", "Name");
return View();
}
[HttpPost]
public IActionResult Create(Registration reg)
{
Reg.Add(reg);
ViewBag.Country = new SelectList(Country.GetCountries(), "Id", "Name");
ViewBag.State = new SelectList(State.GetState(), "Id", "Name");
return RedirectToAction("Index");
}
public IActionResult Edit(int Id)
{
ViewBag.Country = new SelectList(Country.GetCountries(), "Id", "Name");
ViewBag.State = new SelectList(State.GetState(), "Id", "Name");
return View(Reg.Findd(Id));
}
[HttpPost]
public IActionResult Edit(Registration registration)
{
ViewBag.Country = new SelectList(Country.GetCountries(), "Id", "Name");
ViewBag.State = new SelectList(State.GetState(), "Id", "Name");
Reg.Edits(registration);
return RedirectToAction("Index");
}
public IActionResult Details(int Id)
{
return View(Reg.Findd(Id));
}
public IActionResult Delete(int Id)
{
return View(Reg.Findd(Id));
}
[HttpPost]
public IActionResult Delete(Registration registration)
{
Reg.Delete(registration.Id);
return RedirectToAction("Index");
}
}
}
Step10)Make
View
i)index
view
@model IEnumerable<Form1.Models.Registration>
@{
ViewData["Title"] = "Index";
}
<p>
<a asp-action="Create">Create New</a>
</p>
<table class="table table-hover
" id="table_id">
<thead>
<tr>
<th>
@Html.DisplayNameFor(model =>
model.CompanyName)
</th>
<th>
@Html.DisplayNameFor(model => model.Country)
</th>
<th>
@Html.DisplayNameFor(model => model.State)
</th>
<th>
@Html.DisplayNameFor(model =>
model.AddressLine)
</th>
<th>
@Html.DisplayNameFor(model => model.ZipCode)
</th>
<th>
@Html.DisplayNameFor(model =>
model.PhoneNumber)
</th>
<th>
@Html.DisplayNameFor(model => model.Email)
</th>
<th>
@Html.DisplayNameFor(model => model.UserName)
</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
<tr>
<td>
@Html.DisplayFor(modelItem =>
item.CompanyName)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.Country)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.State)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.AddressLine)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.ZipCode)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.PhoneNumber)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.Email)
</td>
<td>
@Html.DisplayFor(modelItem =>
item.UserName)
</td>
<td>
<a asp-action="Edit" asp-route-id="@item.Id" class="btn btn-success">Edit</a>
<a asp-action="Details" asp-route-id="@item.Id" class="btn btn-warning">Details</a>
<a asp-action="Delete" asp-route-id="@item.Id" class="btn btn-danger">Delete</a>
</td>
</tr>
}
</tbody>
</table>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.11.5/css/jquery.dataTables.css">
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.11.5/js/jquery.dataTables.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<script>
$(document).ready(function () {
$('#table_id').DataTable();
});</script>
ii)Create View
@model Form1.Models.Registration
@{
ViewData["Title"] = "Create";
}
<h4 class="row
d-flex justify-content-center">Registration</h4>
<hr />
<div class="row
d-flex justify-content-center">
<div class="col-md-4">
<form asp-action="Create" class="row g-3">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="col-md-12">
<label asp-for="CompanyName" class="control-label"></label>
<input asp-for="CompanyName" class="form-control" />
<span asp-validation-for="CompanyName" class="text-danger"></span>
</div>
<div class="col-md-5">
<label asp-for="Country" class="control-label"></label>
<select asp-for="Country" class="form-control" asp-items="ViewBag.Country">
<option>
Select
</option>
</select>
<span asp-validation-for="Country" class="text-danger"></span>
</div>
<div class="col-md-5">
<label asp-for="State" class="control-label"></label>
<select asp-for="State" class="form-control" asp-items="ViewBag.State">
<option>
Select
</option>
</select>
<span asp-validation-for="State" class="text-danger"></span>
</div>
<div class="col-12">
<label asp-for="AddressLine" class="control-label"></label>
<input asp-for="AddressLine" class="form-control" />
<span asp-validation-for="AddressLine" class="text-danger"></span>
</div>
<div class="col-md-7">
<label asp-for="ZipCode" class="control-label"></label>
<input asp-for="ZipCode" class="form-control" />
<span asp-validation-for="ZipCode" class="text-danger"></span>
</div>
<div class="col-md-6">
<label asp-for="PhoneNumber" class="control-label"></label>
<input asp-for="PhoneNumber" class="form-control" />
<span asp-validation-for="PhoneNumber" class="text-danger"></span>
</div>
<div class="col-md-10">
<label asp-for="Email" class="control-label"></label>
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
<div class="col-md-10">
<label asp-for="UserName" class="control-label"></label>
<input asp-for="UserName" class="form-control" />
<span asp-validation-for="UserName" class="text-danger"></span>
</div>
<div class="col-md-6">
<label asp-for="Password" class="control-label"></label>
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
<div class="col-md-6">
<label asp-for="ConfirmPassword" class="control-label"></label>
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="MustCheck" /> @Html.DisplayNameFor(model
=> model.MustCheck)
</label>
</div>
<hr />
<div class="text-center">
<input type="submit" value="Create Account" class="btn
btn-primary mb-3 row d-flex justify-content-center" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index" class="row
d-flex justify-content-center">Back to List</a>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
iii)Delete View
@model Form1.Models.Registration
@{
ViewData["Title"] = "Delete";
}
<h1>Delete</h1>
<h3>Are you sure you want to delete
this?</h3>
<div>
<h4>Registration</h4>
<hr />
<dl class="row">
<dt class = "col-sm-2">
@Html.DisplayNameFor(model =>
model.CompanyName)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.CompanyName)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Country)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Country)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.State)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.State)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model =>
model.AddressLine)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.AddressLine)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.ZipCode)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.ZipCode)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model =>
model.PhoneNumber)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.PhoneNumber)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Email)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Email)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.UserName)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.UserName)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Password)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Password)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model =>
model.ConfirmPassword)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model =>
model.ConfirmPassword)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.MustCheck)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.MustCheck)
</dd>
</dl>
<form asp-action="Delete">
<input type="hidden" asp-for="Id" />
<input type="submit" value="Delete" class="btn
btn-danger" onclick="return confirm('Are you sure you want to disable this company? @Model.CompanyName')" /> |
<a asp-action="Index">Back to List</a>
</form>
</div>
iv)Details View
@model
Form1.Models.Registration
@{
ViewData["Title"] = "Details";
}
<h1>Details</h1>
<div>
<h4>Registration</h4>
<hr />
<dl class="row">
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.CompanyName)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.CompanyName)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Country)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Country)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.State)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.State)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model =>
model.AddressLine)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.AddressLine)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.ZipCode)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.ZipCode)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model =>
model.PhoneNumber)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.PhoneNumber)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Email)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Email)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.UserName)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.UserName)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.Password)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.Password)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model =>
model.ConfirmPassword)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.ConfirmPassword)
</dd>
<dt class = "col-sm-2">
@Html.DisplayNameFor(model => model.MustCheck)
</dt>
<dd class = "col-sm-10">
@Html.DisplayFor(model => model.MustCheck)
</dd>
</dl>
</div>
<div>
<a asp-action="Edit" asp-route-id="@Model.Id">Edit</a> |
<a asp-action="Index">Back to List</a>
</div>
v)Edit View
@model Form1.Models.Registration
@{
ViewData["Title"] = "Edit";
}
<h1>Edit</h1>
<h4>Registration</h4>
<hr />
<div class="row
d-flex justify-content-center">
<div class="col-md-4">
<form asp-action="Edit" class="row g-3">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="col-md-12">
<label asp-for="CompanyName" class="control-label"></label>
<input asp-for="CompanyName" class="form-control" />
<span asp-validation-for="CompanyName" class="text-danger"></span>
</div>
<div class="col-md-5">
<label asp-for="Country" class="control-label"></label>
<select asp-for="Country" class="form-control" asp-items="ViewBag.Country">
<option>
Denmark
</option>
</select>
<span asp-validation-for="Country" class="text-danger"></span>
</div>
<div class="col-md-5">
<label asp-for="State" class="control-label"></label>
<select asp-for="State" class="form-control" asp-items="ViewBag.State">
<option>
</option>
</select>
<span asp-validation-for="State" class="text-danger"></span>
</div>
<div class="col-12">
<label asp-for="AddressLine" class="control-label"></label>
<input asp-for="AddressLine" class="form-control" />
<span asp-validation-for="AddressLine" class="text-danger"></span>
</div>
<div class="col-md-7">
<label asp-for="ZipCode" class="control-label"></label>
<input asp-for="ZipCode" class="form-control" />
<span asp-validation-for="ZipCode" class="text-danger"></span>
</div>
<div class="col-md-6">
<label asp-for="PhoneNumber" class="control-label"></label>
<input asp-for="PhoneNumber" class="form-control" />
<span asp-validation-for="PhoneNumber" class="text-danger"></span>
</div>
<div class="col-md-10">
<label asp-for="Email" class="control-label"></label>
<input asp-for="Email" class="form-control" />
<span asp-validation-for="Email" class="text-danger"></span>
</div>
<div class="col-md-10">
<label asp-for="UserName" class="control-label"></label>
<input asp-for="UserName" class="form-control" />
<span asp-validation-for="UserName" class="text-danger"></span>
</div>
<div class="col-md-6">
<label asp-for="Password" class="control-label"></label>
<input asp-for="Password" class="form-control" />
<span asp-validation-for="Password" class="text-danger"></span>
</div>
<div class="col-md-6">
<label asp-for="ConfirmPassword" class="control-label"></label>
<input asp-for="ConfirmPassword" class="form-control" />
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" asp-for="MustCheck" /> @Html.DisplayNameFor(model
=> model.MustCheck)
</label>
</div>
<hr />
<div class="form-group">
<input type="submit" value="Update" class="btn
btn-primary" />
</div>
</form>
</div>
</div>
<div>
<a asp-action="Index">Back to List</a>
</div>
@section Scripts {
@{await Html.RenderPartialAsync("_ValidationScriptsPartial");}
}
Step11)Layout page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,
initial-scale=1.0" />
<title>@ViewData["Title"] - Form1</title>
<link href="~/Content/css/dataTables.bootstrap.min.css" rel="stylesheet" />
<link href="~/Content/css/jquery.dataTables.min.css" rel="stylesheet" />
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light
bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Form1</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex
justify-content-between">
<ul class="navbar-nav
flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</li>
</ul>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>
<footer class="border-top
footer text-muted">
<div class="container">
© 2022 - Form1 - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
</div>
</footer>
<script src="~/lib/jquery/dist/jquery.min.js"></script>
<script src="~/Content/Js/jquery.dataTables.min.js"></script>
<script src="~/Content/Js/dataTables.bootstrap.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="~/js/site.js" asp-append-version="true"></script>
<script>
$(document).ready(function () {
$('#table_id').DataTable();
});</script>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>
Output=>
No comments: