Results site in .NET Core
This commit is contained in:
@ -1,14 +1,16 @@
|
||||
@page
|
||||
@model Result.Pages.IndexModel
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Cats vs Dogs -- Result</title>
|
||||
<title>@Model.OptionA vs @Model.OptionB -- Result</title>
|
||||
<base href="/index.html">
|
||||
<meta name="viewport" content="width=device-width, initial-scale = 1.0">
|
||||
<meta name="keywords" content="docker-compose, docker, stack">
|
||||
<meta name="author" content="Docker">
|
||||
<link rel='stylesheet' href='/stylesheets/style.css' />
|
||||
<link rel='stylesheet' href='~/css/site.css' />
|
||||
</head>
|
||||
<body>
|
||||
<div id="background-stats">
|
||||
@ -22,22 +24,20 @@
|
||||
<div id="content-container">
|
||||
<div id="content-container-center">
|
||||
<div id="choice">
|
||||
<div class="choice cats">
|
||||
<div class="label">Cats</div>
|
||||
<div class="choice resulta">
|
||||
<div class="label">@Model.OptionA</div>
|
||||
<div class="stat" id="optionA"></div>
|
||||
</div>
|
||||
<div class="divider"></div>
|
||||
<div class="choice dogs">
|
||||
<div class="label">Dogs</div>
|
||||
<div class="choice resultb">
|
||||
<div class="label">@Model.OptionB</div>
|
||||
<div class="stat" id="optionB"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="result">
|
||||
<span ng-if="total == 0">No votes yet</span>
|
||||
<span ng-if="total == 1">{{total}} vote</span>
|
||||
<span ng-if="total >= 2">{{total}} votes</span>
|
||||
<span id="totalVotes">No votes yet</span>
|
||||
</div>
|
||||
<script src="~/lib/signalr/dist/browser/signalr.js"></script>
|
||||
<script src="~/js/results.js"></script>
|
||||
|
@ -4,14 +4,30 @@ using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.RazorPages;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Result.Pages
|
||||
{
|
||||
public class IndexModel : PageModel
|
||||
{
|
||||
private string _optionA;
|
||||
private string _optionB;
|
||||
protected readonly IConfiguration _configuration;
|
||||
|
||||
public string OptionA { get; private set; }
|
||||
public string OptionB { get; private set; }
|
||||
|
||||
public IndexModel(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
_optionA = _configuration.GetValue<string>("Voting:OptionA");
|
||||
_optionB = _configuration.GetValue<string>("Voting:OptionB");
|
||||
}
|
||||
|
||||
public void OnGet()
|
||||
{
|
||||
|
||||
OptionA = _optionA;
|
||||
OptionB = _optionB;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user