Try to add meta-tag whilst using asp mvc

This commit is contained in:
Dmitriy yawaflua Andreev
2024-07-08 02:45:15 +03:00
parent e66edc2730
commit 3f889e0c25
4 changed files with 39 additions and 1 deletions

3
MVC/Pay.cshtml Normal file
View File

@@ -0,0 +1,3 @@
@page "{username}"
@model OembedTests.MVC.PayModel
<p>@Model.username</p>

14
MVC/Pay.cshtml.cs Normal file
View File

@@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace OembedTests.MVC
{
public class PayModel : PageModel
{
public string username { get; set; }
public void OnGet(string username)
{
this.username = username;
}
}
}

19
MVC/_Layout.cshtml Normal file
View File

@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
@{
string oembedUrl = "https://" + Context.Request.Host.Host + "/oembed";
}
<link rel="alternate" type="application/json+oembed"
href="https://oembed-tests.yawaflua.ru/oembed/https://oembed-tests.yawaflua.ru/pay/yawaflua&format=json"
title="Donate to yawaflua now" />
</head>
<body>
<div>
@RenderBody()
</div>
</body>
</html>

View File

@@ -20,7 +20,8 @@
services
.AddSwaggerGen()
.AddSingleton(configuration)
.AddEndpointsApiExplorer();
.AddEndpointsApiExplorer()
.AddRazorPages();
}
@@ -41,6 +42,7 @@
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
endpoints.MapRazorPages();
});
}
}