Skip to content

Commit 22287c8

Browse files
Add MVC support to Blazor 9 application
Co-authored-by: ADefWebserver <1857799+ADefWebserver@users.noreply.github.com>
1 parent 312cde4 commit 22287c8

7 files changed

Lines changed: 141 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace RFPResponseAPP.Controllers;
4+
5+
public class HomeController : Controller
6+
{
7+
public IActionResult Index()
8+
{
9+
return View();
10+
}
11+
12+
public IActionResult About()
13+
{
14+
return View();
15+
}
16+
}

RFPResponsePOC/RFPResponsePOC/Program.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ public static void Main(string[] args)
1818
builder.Services.AddRazorComponents()
1919
.AddInteractiveWebAssemblyComponents();
2020

21+
// Add MVC support
22+
builder.Services.AddControllersWithViews();
23+
builder.Services.AddRazorPages();
24+
2125
builder.Services.AddRadzenComponents();
2226

2327
// Local Storage
@@ -56,6 +60,15 @@ public static void Main(string[] args)
5660
app.UseAntiforgery();
5761

5862
app.MapStaticAssets();
63+
64+
// Map MVC controller routes
65+
app.MapControllerRoute(
66+
name: "default",
67+
pattern: "{controller=Home}/{action=Index}/{id?}");
68+
69+
// Map Razor Pages
70+
app.MapRazorPages();
71+
5972
app.MapRazorComponents<App>()
6073
.AddInteractiveWebAssemblyRenderMode()
6174
.AddAdditionalAssemblies(typeof(Client._Imports).Assembly);
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@{
2+
ViewData["Title"] = "About";
3+
}
4+
5+
<div class="text-center">
6+
<h1 class="display-4">@ViewData["Title"]</h1>
7+
<p>Learn about the RFP Response Creator application.</p>
8+
</div>
9+
10+
<div class="row mt-5">
11+
<div class="col-md-12">
12+
<h2>About RFP Response APP</h2>
13+
<p>
14+
RFP Response Creator is a SaaS application that automates professional Request for Proposal (RFP) responses.
15+
Using AI, it extracts questions, generates answers from your knowledge base, and produces polished Word/PDF documents.
16+
</p>
17+
<h3>Key Features</h3>
18+
<ul>
19+
<li>AI-Powered Document Processing</li>
20+
<li>Intelligent Question Detection & Answering</li>
21+
<li>Venue Management System</li>
22+
<li>Template System</li>
23+
<li>Knowledge Base Management</li>
24+
<li>Document Generation</li>
25+
</ul>
26+
<p class="mt-4">
27+
<a asp-controller="Home" asp-action="Index" class="btn btn-secondary">Back to Home</a>
28+
</p>
29+
</div>
30+
</div>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@{
2+
ViewData["Title"] = "Home Page";
3+
}
4+
5+
<div class="text-center">
6+
<h1 class="display-4">Welcome to RFP Response APP</h1>
7+
<p>This is an MVC view running in Blazor 9.</p>
8+
<p>
9+
<a href="/" class="btn btn-primary">Go to Blazor App</a>
10+
</p>
11+
</div>
12+
13+
<div class="row mt-5">
14+
<div class="col-md-12">
15+
<h2>MVC Integration</h2>
16+
<p>
17+
This application demonstrates the integration of ASP.NET Core MVC with Blazor components.
18+
You can use traditional MVC controllers and views alongside your Blazor components.
19+
</p>
20+
<ul>
21+
<li>MVC controllers handle traditional request/response patterns</li>
22+
<li>Blazor components provide interactive, rich client-side experiences</li>
23+
<li>Both can coexist in the same application</li>
24+
</ul>
25+
</div>
26+
</div>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>@ViewData["Title"] - RFP Response APP</title>
7+
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
8+
<link rel="stylesheet" href="~/app.css" />
9+
</head>
10+
<body>
11+
<header>
12+
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
13+
<div class="container-fluid">
14+
<a class="navbar-brand" asp-controller="Home" asp-action="Index">RFP Response APP</a>
15+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
16+
aria-expanded="false" aria-label="Toggle navigation">
17+
<span class="navbar-toggler-icon"></span>
18+
</button>
19+
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
20+
<ul class="navbar-nav flex-grow-1">
21+
<li class="nav-item">
22+
<a class="nav-link text-dark" asp-controller="Home" asp-action="Index">Home</a>
23+
</li>
24+
<li class="nav-item">
25+
<a class="nav-link text-dark" asp-controller="Home" asp-action="About">About</a>
26+
</li>
27+
<li class="nav-item">
28+
<a class="nav-link text-dark" href="/">Blazor App</a>
29+
</li>
30+
</ul>
31+
</div>
32+
</div>
33+
</nav>
34+
</header>
35+
<div class="container">
36+
<main role="main" class="pb-3">
37+
@RenderBody()
38+
</main>
39+
</div>
40+
41+
<footer class="border-top footer text-muted">
42+
<div class="container">
43+
&copy; 2025 - RFP Response APP - <a asp-controller="Home" asp-action="Index">Home</a>
44+
</div>
45+
</footer>
46+
47+
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
48+
@await RenderSectionAsync("Scripts", required: false)
49+
</body>
50+
</html>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@using RFPResponseAPP
2+
@using RFPResponseAPP.Controllers
3+
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@{
2+
Layout = "_Layout";
3+
}

0 commit comments

Comments
 (0)