Create new Web Project
This commit is contained in:
18
EnvelopeGenerator.Web/Pages/Counter.razor
Normal file
18
EnvelopeGenerator.Web/Pages/Counter.razor
Normal file
@@ -0,0 +1,18 @@
|
||||
@page "/counter"
|
||||
|
||||
<PageTitle>Counter</PageTitle>
|
||||
|
||||
<h1>Counter</h1>
|
||||
|
||||
<p role="status">Current count: @currentCount</p>
|
||||
|
||||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button>
|
||||
|
||||
@code {
|
||||
private int currentCount = 0;
|
||||
|
||||
private void IncrementCount()
|
||||
{
|
||||
currentCount++;
|
||||
}
|
||||
}
|
||||
48
EnvelopeGenerator.Web/Pages/FetchData.razor
Normal file
48
EnvelopeGenerator.Web/Pages/FetchData.razor
Normal file
@@ -0,0 +1,48 @@
|
||||
@page "/fetchdata"
|
||||
|
||||
<PageTitle>Weather forecast</PageTitle>
|
||||
|
||||
@using EnvelopeGenerator.Web.Data
|
||||
@inject WeatherForecastService ForecastService
|
||||
|
||||
<h1>Weather forecast</h1>
|
||||
|
||||
<p>This component demonstrates fetching data from a service.</p>
|
||||
|
||||
@if (forecasts == null)
|
||||
{
|
||||
<p><em>Loading...</em></p>
|
||||
}
|
||||
else
|
||||
{
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Temp. (C)</th>
|
||||
<th>Temp. (F)</th>
|
||||
<th>Summary</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var forecast in forecasts)
|
||||
{
|
||||
<tr>
|
||||
<td>@forecast.Date.ToShortDateString()</td>
|
||||
<td>@forecast.TemperatureC</td>
|
||||
<td>@forecast.TemperatureF</td>
|
||||
<td>@forecast.Summary</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
}
|
||||
|
||||
@code {
|
||||
private WeatherForecast[]? forecasts;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
forecasts = await ForecastService.GetForecastAsync(DateTime.Now);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
@page "/EnvelopeKey/Finish"
|
||||
|
||||
<h3>Dokumente signiert</h3>
|
||||
|
||||
<p>Sie haben den Umschlag erfolgreich signiert!</p>
|
||||
@@ -1,39 +1,9 @@
|
||||
@page "/"
|
||||
@using EnvelopeGenerator.Common;
|
||||
@using EnvelopeGenerator.Web.Services;
|
||||
@inject EnvelopeService Envelope;
|
||||
|
||||
<PageTitle>Index</PageTitle>
|
||||
|
||||
<ul>
|
||||
@foreach (var envelope in envelopes)
|
||||
{
|
||||
<li><a href="/EnvelopeKey/@getEnvelopeKey(envelope)">@envelope.Title</a></li>
|
||||
}
|
||||
</ul>
|
||||
<h1>Hello, world!</h1>
|
||||
|
||||
@code {
|
||||
public List<Envelope> envelopes = new();
|
||||
Welcome to your new app.
|
||||
|
||||
// List envelopes delivered to j.jenne@digitaldata.works
|
||||
public int receiverId = 11;
|
||||
|
||||
string? getReceiverSignature(Envelope envelope)
|
||||
{
|
||||
var receiver = envelope.Receivers.Where(r => r.Id == receiverId).SingleOrDefault();
|
||||
return receiver?.Signature;
|
||||
}
|
||||
|
||||
string getEnvelopeKey(Envelope envelope)
|
||||
{
|
||||
return Helpers.EncodeEnvelopeReceiverId(envelope.Uuid, getReceiverSignature(envelope));
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// Test
|
||||
envelopes = Envelope.LoadEnvelopes(receiverId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
<SurveyPrompt Title="How is Blazor working for you?" />
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
@page "/EnvelopeKey/{EnvelopeReceiverId}"
|
||||
|
||||
@using EnvelopeGenerator.Common;
|
||||
@using EnvelopeGenerator.Web.Services;
|
||||
@inject DatabaseService Database
|
||||
@inject IJSRuntime JS
|
||||
|
||||
<div id='container' style='background: gray; width: 100vw; height: 100vh; margin: 0 auto;'></div>
|
||||
|
||||
@code {
|
||||
[Parameter] public string EnvelopeReceiverId { get; set; }
|
||||
|
||||
protected override async void OnAfterRender(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
var module = await JS.InvokeAsync<IJSObjectReference>("import", "./js/app.js");
|
||||
await module.InvokeVoidAsync("App.init", "#container", EnvelopeReceiverId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,4 @@
|
||||
Layout = "_Layout";
|
||||
}
|
||||
|
||||
@* Include pspdfkit.js in your Pages/_Host.cshtml file *@
|
||||
<script src="lib/pspdfkit.js"></script>
|
||||
<script src="js/app.js"></script>
|
||||
|
||||
<component type="typeof(App)" render-mode="ServerPrerendered" />
|
||||
|
||||
@@ -3,13 +3,10 @@
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
|
||||
|
||||
<base href="~/" />
|
||||
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
|
||||
<link href="css/site.css" rel="stylesheet" />
|
||||
@@ -31,7 +28,5 @@
|
||||
</div>
|
||||
|
||||
<script src="_framework/blazor.server.js"></script>
|
||||
|
||||
@Html.AntiForgeryToken()
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user