Skip to content

Commit ec3c09a

Browse files
committed
Alterado o framework para ASP.NET MVC
1 parent f9a62ff commit ec3c09a

15 files changed

+69
-153
lines changed

.config/dotnet-tools.json

-12
This file was deleted.

.dockerignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,4 @@
2121
**/obj
2222
**/secrets.dev.yaml
2323
**/values.dev.yaml
24-
LICENSE
25-
README.md
24+
LICENSE

App.razor

-9
This file was deleted.

Controllers/HomeController.cs

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
3+
namespace edsonluizcandido.Controllers
4+
{
5+
6+
public class HomeController : Controller
7+
{
8+
[Route("/")]
9+
public IActionResult Index()
10+
{
11+
ViewBag.Title = "Edson Luiz Candido";
12+
var md = System.IO.File.ReadAllText("wwwroot/Index.md");
13+
string html = Markdig.Markdown.ToHtml(md);
14+
return View("View", html);
15+
}
16+
}
17+
}

MainLayout.razor

-3
This file was deleted.

Pages/Index.razor

-39
This file was deleted.

Pages/_Host.cshtml

-44
This file was deleted.

Program.cs

+25-19
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
1-
using Microsoft.AspNetCore.Components;
2-
using Microsoft.AspNetCore.Components.Web;
3-
using Microsoft.AspNetCore.WebSockets;
1+
namespace edsonluizcandido
2+
{
3+
public class Program
4+
{
5+
public static void Main(string[] args)
6+
{
7+
var builder = WebApplication.CreateBuilder(args);
48

5-
var builder = WebApplication.CreateBuilder(args);
6-
builder.Services.AddRazorPages();
7-
builder.Services.AddServerSideBlazor();
8-
builder.Services.AddHttpClient();
9-
builder.Services.AddServerSideBlazor()
10-
.AddHubOptions(o => {
11-
o.ClientTimeoutInterval = TimeSpan.FromMinutes(30);
12-
o.HandshakeTimeout = TimeSpan.FromMinutes(30);
13-
});
9+
builder.Services.AddMvc(options =>
10+
{
11+
options.EnableEndpointRouting = false;
12+
});
1413

15-
var app = builder.Build();
14+
var app = builder.Build();
15+
16+
IHostEnvironment hostEnvironment = app.Services.GetRequiredService<IHostEnvironment>();
1617

17-
app.UseStaticFiles();
18+
if (hostEnvironment.IsDevelopment())
19+
{
20+
app.UseDeveloperExceptionPage();
21+
}
1822

19-
app.UseRouting();
23+
app.UseStaticFiles();
2024

21-
app.MapBlazorHub();
22-
app.MapFallbackToPage("/_Host");
25+
app.UseMvcWithDefaultRoute();
2326

24-
app.UseWebSockets();
27+
//app.MapGet("/", () => "Hello World!");
2528

26-
app.Run();
29+
app.Run();
30+
}
31+
}
32+
}

Properties/launchSettings.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"ASPNETCORE_ENVIRONMENT": "Development"
88
},
99
"dotnetRunMessages": true,
10-
"applicationUrl": "http://localhost:5059"
10+
"applicationUrl": "http://localhost:5185"
1111
},
1212
"IIS Express": {
1313
"commandName": "IISExpress",
@@ -18,7 +18,6 @@
1818
},
1919
"Docker": {
2020
"commandName": "Docker",
21-
"commandLineArgs": "-t edsonluizcandido:latest\r\n-t edsonluizcandido:0.9.4",
2221
"launchBrowser": true,
2322
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
2423
"environmentVariables": {
@@ -31,7 +30,7 @@
3130
"windowsAuthentication": false,
3231
"anonymousAuthentication": true,
3332
"iisExpress": {
34-
"applicationUrl": "http://localhost:38441",
33+
"applicationUrl": "http://localhost:8821",
3534
"sslPort": 0
3635
}
3736
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Site escrito em Blazor Server para gera
77
## para devs
88

99
- utilizado a biblioteca Markdig para converter markdown em html
10-
- BlazorSerer, programado em C#
10+
- ASP.NET MVC programado em C#
1111
- docker para subir o site em um container e rodar em servidor linux
1212

1313
## proximos passos

Views/Home/View.cshtml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
@model string
2+
<!DOCTYPE html>
3+
4+
<html>
5+
<head>
6+
<meta name="viewport" content="width=device-width, initial-scale=1" />
7+
<title>@ViewBag.Title</title>
8+
<link href="css/reset.css" rel="stylesheet" />
9+
<link href="css/style.css" rel="stylesheet" />
10+
</head>
11+
<body>
12+
@Html.Raw(Model)
13+
</body>
14+
</html>

_Imports.razor

-4
This file was deleted.

appsettings.Development.json

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"DetailedErrors": true,
32
"Logging": {
43
"LogLevel": {
54
"Default": "Information",

edsonluizcandido.csproj

+2-9
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,10 @@
88
<DockerfileContext>.</DockerfileContext>
99
</PropertyGroup>
1010

11-
<ItemGroup>
12-
<Content Remove="wwwroot\Index.md" />
13-
</ItemGroup>
14-
15-
<ItemGroup>
16-
<EmbeddedResource Include="wwwroot\Index.md" />
17-
</ItemGroup>
18-
1911
<ItemGroup>
2012
<PackageReference Include="Markdig" Version="0.33.0" />
21-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
13+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.4" />
14+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="7.0.9" />
2215
</ItemGroup>
2316

2417
</Project>

edsonluizcandido.sln

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio Version 17
4-
VisualStudioVersion = 17.7.34024.191
4+
VisualStudioVersion = 17.7.34031.279
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "edsonluizcandido", "edsonluizcandido.csproj", "{957C7D64-EFCB-4CC4-847C-47FAB8BADE7F}"
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "edsonluizcandido", "edsonluizcandido.csproj", "{00121FF0-BA57-44B5-BFD1-606310ECB0EC}"
77
EndProject
88
Global
99
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1010
Debug|Any CPU = Debug|Any CPU
1111
Release|Any CPU = Release|Any CPU
1212
EndGlobalSection
1313
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14-
{957C7D64-EFCB-4CC4-847C-47FAB8BADE7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15-
{957C7D64-EFCB-4CC4-847C-47FAB8BADE7F}.Debug|Any CPU.Build.0 = Debug|Any CPU
16-
{957C7D64-EFCB-4CC4-847C-47FAB8BADE7F}.Release|Any CPU.ActiveCfg = Release|Any CPU
17-
{957C7D64-EFCB-4CC4-847C-47FAB8BADE7F}.Release|Any CPU.Build.0 = Release|Any CPU
14+
{00121FF0-BA57-44B5-BFD1-606310ECB0EC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{00121FF0-BA57-44B5-BFD1-606310ECB0EC}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{00121FF0-BA57-44B5-BFD1-606310ECB0EC}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{00121FF0-BA57-44B5-BFD1-606310ECB0EC}.Release|Any CPU.Build.0 = Release|Any CPU
1818
EndGlobalSection
1919
GlobalSection(SolutionProperties) = preSolution
2020
HideSolutionNode = FALSE
2121
EndGlobalSection
2222
GlobalSection(ExtensibilityGlobals) = postSolution
23-
SolutionGuid = {25D82660-22C0-4F06-BE65-553DC7A7F31A}
23+
SolutionGuid = {4328820A-2557-4848-8A78-27BF1F71FF54}
2424
EndGlobalSection
2525
EndGlobal

0 commit comments

Comments
 (0)