Skip to content

Commit f22986e

Browse files
authored
Add files via upload
1 parent 2e59c0e commit f22986e

File tree

84 files changed

+87277
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+87277
-0
lines changed

HTTP ECGridOS API v4.1 .NET 6 ASPNET Core WebApp/ECGridOSClient.cs

Lines changed: 10221 additions & 0 deletions
Large diffs are not rendered by default.

HTTP ECGridOS API v4.1 .NET 6 ASPNET Core WebApp/ECGridOS_Classes.cs

Lines changed: 2482 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net6.0</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
<RootNamespace>HTTP_ECGridOS_API_v4._1_.NET_6_ASPNET_Core_WebApp</RootNamespace>
8+
</PropertyGroup>
9+
10+
</Project>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@page
2+
@model ErrorModel
3+
@{
4+
ViewData["Title"] = "Error";
5+
}
6+
7+
<h1 class="text-danger">Error.</h1>
8+
<h2 class="text-danger">An error occurred while processing your request.</h2>
9+
10+
@if (Model.ShowRequestId)
11+
{
12+
<p>
13+
<strong>Request ID:</strong> <code>@Model.RequestId</code>
14+
</p>
15+
}
16+
17+
<h3>Development Mode</h3>
18+
<p>
19+
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
23+
It can result in displaying sensitive information from exceptions to end users.
24+
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
25+
and restarting the app.
26+
</p>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
4+
using System.Diagnostics;
5+
6+
namespace HTTP_ECGridOS_API_v4._1_.NET_6_ASPNET_Core_WebApp.Pages;
7+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
8+
[IgnoreAntiforgeryToken]
9+
public class ErrorModel : PageModel
10+
{
11+
public string? RequestId { get; set; }
12+
13+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
14+
15+
private readonly ILogger<ErrorModel> _logger;
16+
17+
public ErrorModel(ILogger<ErrorModel> logger)
18+
{
19+
_logger = logger;
20+
}
21+
22+
public void OnGet()
23+
{
24+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
25+
}
26+
}
27+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@page
2+
@model IndexModel
3+
@{
4+
ViewData["Title"] = "Home page";
5+
}
6+
7+
<div class="text-center">
8+
<h1 class="display-4">ECGridOS Results</h1>
9+
<p>Version: @ViewData["EGridVersion"]</p>
10+
<p>SessionID: @ViewData["EGridSessionID"]</p>
11+
</div>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
using Microsoft.AspNetCore.DataProtection.KeyManagement;
2+
using Microsoft.AspNetCore.Mvc;
3+
using Microsoft.AspNetCore.Mvc.RazorPages;
4+
5+
namespace HTTP_ECGridOS_API_v4._1_.NET_6_ASPNET_Core_WebApp.Pages;
6+
public class IndexModel : PageModel
7+
{
8+
private readonly ILogger<IndexModel> _logger;
9+
private readonly IConfiguration _Configuration;
10+
private readonly IECGridOSClient _ECGridOSClient;
11+
private readonly string APIKey = String.Empty;
12+
13+
public IndexModel(ILogger<IndexModel> logger, IConfiguration Configuration, IECGridOSClient ECGridOSClient)
14+
{
15+
_logger = logger;
16+
_Configuration = Configuration;
17+
_ECGridOSClient = ECGridOSClient;
18+
APIKey = _Configuration["ECGridOS:APIKey"];
19+
}
20+
21+
public void OnGet()
22+
{
23+
string APIVersion = _ECGridOSClient.Version().Result;
24+
if (!string.IsNullOrEmpty(APIVersion))
25+
{
26+
ViewData["EGridVersion"] = APIVersion;
27+
}
28+
else
29+
{
30+
ViewData["EGridVersion"] = "No result returned, ECGridOS might not be running.";
31+
}
32+
33+
SessionInfo sessionInfo = _ECGridOSClient.WhoAmI(APIKey).Result;
34+
if (!string.IsNullOrEmpty(sessionInfo.SessionID))
35+
{
36+
ViewData["EGridSessionID"] = sessionInfo.SessionID;
37+
}
38+
else
39+
{
40+
ViewData["EGridSessionID"] = "No Sessions ID, I might ned to check my APIKey or call the Login API Endpoint";
41+
}
42+
}
43+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
@page
2+
@model PrivacyModel
3+
@{
4+
ViewData["Title"] = "Privacy Policy";
5+
}
6+
<h1>@ViewData["Title"]</h1>
7+
8+
<p>Use this page to detail your site's privacy policy.</p>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using Microsoft.AspNetCore.Mvc;
2+
using Microsoft.AspNetCore.Mvc.RazorPages;
3+
4+
namespace HTTP_ECGridOS_API_v4._1_.NET_6_ASPNET_Core_WebApp.Pages;
5+
public class PrivacyModel : PageModel
6+
{
7+
private readonly ILogger<PrivacyModel> _logger;
8+
9+
public PrivacyModel(ILogger<PrivacyModel> logger)
10+
{
11+
_logger = logger;
12+
}
13+
14+
public void OnGet()
15+
{
16+
}
17+
}
18+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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"] - HTTP_ECGridOS_API_v4._1_.NET_6_ASPNET_Core_WebApp</title>
7+
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
8+
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
9+
<link rel="stylesheet" href="~/HTTP_ECGridOS_API_v4._1_.NET_6_ASPNET_Core_WebApp.styles.css" asp-append-version="true" />
10+
</head>
11+
<body>
12+
<header>
13+
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
14+
<div class="container">
15+
<a class="navbar-brand" asp-area="" asp-page="/Index">HTTP_ECGridOS_API_v4._1_.NET_6_ASPNET_Core_WebApp</a>
16+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
17+
aria-expanded="false" aria-label="Toggle navigation">
18+
<span class="navbar-toggler-icon"></span>
19+
</button>
20+
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
21+
<ul class="navbar-nav flex-grow-1">
22+
<li class="nav-item">
23+
<a class="nav-link text-dark" asp-area="" asp-page="/Index">Home</a>
24+
</li>
25+
<li class="nav-item">
26+
<a class="nav-link text-dark" asp-area="" asp-page="/Privacy">Privacy</a>
27+
</li>
28+
</ul>
29+
</div>
30+
</div>
31+
</nav>
32+
</header>
33+
<div class="container">
34+
<main role="main" class="pb-3">
35+
@RenderBody()
36+
</main>
37+
</div>
38+
39+
<footer class="border-top footer text-muted">
40+
<div class="container">
41+
&copy; 2022 - HTTP_ECGridOS_API_v4._1_.NET_6_ASPNET_Core_WebApp - <a asp-area="" asp-page="/Privacy">Privacy</a>
42+
</div>
43+
</footer>
44+
45+
<script src="~/lib/jquery/dist/jquery.min.js"></script>
46+
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
47+
<script src="~/js/site.js" asp-append-version="true"></script>
48+
49+
@await RenderSectionAsync("Scripts", required: false)
50+
</body>
51+
</html>

0 commit comments

Comments
 (0)