Skip to content

Commit 4c68140

Browse files
committed
Let us add some code...
1 parent f5da93c commit 4c68140

File tree

80 files changed

+25480
-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.

80 files changed

+25480
-0
lines changed

ScryfallApi.sln

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27004.2009
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScryfallApi.Client", "src\ScryfallApi.Client\ScryfallApi.Client.csproj", "{80A567E0-6C64-46BE-A724-83E13344A8D0}"
7+
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{C470746D-B24E-4759-B7A3-6C8EDD801544}"
9+
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScryfallApi.WebSample", "samples\ScryfallApi.WebSample\ScryfallApi.WebSample.csproj", "{383BF6C1-47B7-47E8-8428-B3A114EFC3B0}"
11+
EndProject
12+
Global
13+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
14+
Debug|Any CPU = Debug|Any CPU
15+
Release|Any CPU = Release|Any CPU
16+
EndGlobalSection
17+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
18+
{80A567E0-6C64-46BE-A724-83E13344A8D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
19+
{80A567E0-6C64-46BE-A724-83E13344A8D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
20+
{80A567E0-6C64-46BE-A724-83E13344A8D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
21+
{80A567E0-6C64-46BE-A724-83E13344A8D0}.Release|Any CPU.Build.0 = Release|Any CPU
22+
{383BF6C1-47B7-47E8-8428-B3A114EFC3B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
23+
{383BF6C1-47B7-47E8-8428-B3A114EFC3B0}.Debug|Any CPU.Build.0 = Debug|Any CPU
24+
{383BF6C1-47B7-47E8-8428-B3A114EFC3B0}.Release|Any CPU.ActiveCfg = Release|Any CPU
25+
{383BF6C1-47B7-47E8-8428-B3A114EFC3B0}.Release|Any CPU.Build.0 = Release|Any CPU
26+
EndGlobalSection
27+
GlobalSection(SolutionProperties) = preSolution
28+
HideSolutionNode = FALSE
29+
EndGlobalSection
30+
GlobalSection(NestedProjects) = preSolution
31+
{383BF6C1-47B7-47E8-8428-B3A114EFC3B0} = {C470746D-B24E-4759-B7A3-6C8EDD801544}
32+
EndGlobalSection
33+
GlobalSection(ExtensibilityGlobals) = postSolution
34+
SolutionGuid = {4C1168D1-1DC7-410F-9D8C-E23492A1FD2F}
35+
EndGlobalSection
36+
EndGlobal
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
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 <strong>Development</strong> environment will display more detailed information about the error that occurred.
20+
</p>
21+
<p>
22+
<strong>Development environment should not be enabled in deployed applications</strong>, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>, and restarting the application.
23+
</p>
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Diagnostics;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore.Mvc;
7+
using Microsoft.AspNetCore.Mvc.RazorPages;
8+
9+
namespace ScryfallApi.WebSample.Pages
10+
{
11+
public class ErrorModel : PageModel
12+
{
13+
public string RequestId { get; set; }
14+
15+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
16+
17+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
18+
public void OnGet()
19+
{
20+
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
21+
}
22+
}
23+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
@page
2+
@model IndexModel
3+
@{
4+
ViewData["Title"] = "Home";
5+
}
6+
7+
<h2>@ViewData["Title"]</h2>
8+
<h3>Random Card: <a href="@Model.RandomCard.ScryfallUri">@Model.RandomCard.Name</a></h3>
9+
<div class="row">
10+
<div class="col-md-12">
11+
<a href="@Model.RandomCard.ScryfallUri">
12+
<img src="@Model.RandomCard.ImageUris["normal"]" style="max-width: 320px;" />
13+
</a>
14+
</div>
15+
</div>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Microsoft.AspNetCore.Mvc.RazorPages;
4+
using ScryfallApi.Client;
5+
using ScryfallApi.Client.Models;
6+
7+
namespace ScryfallApi.WebSample.Pages
8+
{
9+
public class IndexModel : PageModel
10+
{
11+
ScryfallApiClient _scryfallApi { get; }
12+
13+
public IndexModel(ScryfallApiClient scryfallApi)
14+
{
15+
_scryfallApi = scryfallApi ?? throw new ArgumentNullException(nameof(scryfallApi));
16+
}
17+
18+
public async Task OnGet()
19+
{
20+
RandomCard = await _scryfallApi.Cards.GetRandom();
21+
}
22+
23+
public Card RandomCard { get; set; }
24+
}
25+
}
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+
<h2>@ViewData["Title"]</h2>
7+
8+
<p>Use this page to detail your site's privacy policy.</p>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Mvc;
6+
using Microsoft.AspNetCore.Mvc.RazorPages;
7+
8+
namespace ScryfallApi.WebSample.Pages
9+
{
10+
public class PrivacyModel : PageModel
11+
{
12+
public void OnGet()
13+
{
14+
}
15+
}
16+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
@using Microsoft.AspNetCore.Http.Features
2+
3+
@{
4+
var consentFeature = Context.Features.Get<ITrackingConsentFeature>();
5+
var showBanner = !consentFeature?.CanTrack ?? false;
6+
var cookieString = consentFeature?.CreateConsentCookie();
7+
}
8+
9+
@if (showBanner)
10+
{
11+
<nav id="cookieConsent" class="navbar navbar-default navbar-fixed-top" role="alert">
12+
<div class="container">
13+
<div class="navbar-header">
14+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#cookieConsent .navbar-collapse">
15+
<span class="sr-only">Toggle cookie consent banner</span>
16+
<span class="icon-bar"></span>
17+
<span class="icon-bar"></span>
18+
<span class="icon-bar"></span>
19+
</button>
20+
<span class="navbar-brand"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span></span>
21+
</div>
22+
<div class="collapse navbar-collapse">
23+
<p class="navbar-text">
24+
Use this space to summarize your privacy and cookie use policy.
25+
</p>
26+
<div class="navbar-right">
27+
<a asp-page="/Privacy" class="btn btn-info navbar-btn">Learn More</a>
28+
<button type="button" class="btn btn-default navbar-btn" data-cookie-string="@cookieString">Accept</button>
29+
</div>
30+
</div>
31+
</div>
32+
</nav>
33+
<script>
34+
(function () {
35+
document.querySelector("#cookieConsent button[data-cookie-string]").addEventListener("click", function (el) {
36+
document.cookie = el.target.dataset.cookieString;
37+
document.querySelector("#cookieConsent").classList.add("hidden");
38+
}, false);
39+
})();
40+
</script>
41+
}
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>@ViewData["Title"] - ScryfallApi.WebSample</title>
7+
8+
<environment include="Development">
9+
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
10+
<link rel="stylesheet" href="~/css/site.css" />
11+
</environment>
12+
<environment exclude="Development">
13+
<link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
14+
asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
15+
asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
16+
<link rel="stylesheet" href="~/css/site.min.css" asp-append-version="true" />
17+
</environment>
18+
</head>
19+
<body>
20+
<nav class="navbar navbar-inverse navbar-fixed-top">
21+
<div class="container">
22+
<div class="navbar-header">
23+
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
24+
<span class="sr-only">Toggle navigation</span>
25+
<span class="icon-bar"></span>
26+
<span class="icon-bar"></span>
27+
<span class="icon-bar"></span>
28+
</button>
29+
<a asp-page="/Index" class="navbar-brand">ScryfallApi.WebSample</a>
30+
</div>
31+
<div class="navbar-collapse collapse">
32+
<ul class="nav navbar-nav">
33+
<li><a asp-page="/Index">Home</a></li>
34+
</ul>
35+
</div>
36+
</div>
37+
</nav>
38+
39+
<partial name="_CookieConsentPartial" />
40+
41+
<div class="container body-content">
42+
@RenderBody()
43+
<hr />
44+
<footer>
45+
<p>&copy; 2018 - ScryfallApi.WebSample</p>
46+
</footer>
47+
</div>
48+
49+
<environment include="Development">
50+
<script src="~/lib/jquery/dist/jquery.js"></script>
51+
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
52+
<script src="~/js/site.js" asp-append-version="true"></script>
53+
</environment>
54+
<environment exclude="Development">
55+
<script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.3.1.min.js"
56+
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
57+
asp-fallback-test="window.jQuery"
58+
crossorigin="anonymous"
59+
integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT">
60+
</script>
61+
<script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
62+
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
63+
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
64+
crossorigin="anonymous"
65+
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
66+
</script>
67+
<script src="~/js/site.min.js" asp-append-version="true"></script>
68+
</environment>
69+
70+
@RenderSection("Scripts", required: false)
71+
</body>
72+
</html>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<environment include="Development">
2+
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
3+
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
4+
</environment>
5+
<environment exclude="Development">
6+
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.17.0/jquery.validate.min.js"
7+
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
8+
asp-fallback-test="window.jQuery && window.jQuery.validator"
9+
crossorigin="anonymous"
10+
integrity="sha384-rZfj/ogBloos6wzLGpPkkOr/gpkBNLZ6b6yLy4o+ok+t/SAKlL5mvXLr0OXNi1Hp">
11+
</script>
12+
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.9/jquery.validate.unobtrusive.min.js"
13+
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
14+
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
15+
crossorigin="anonymous"
16+
integrity="sha384-ifv0TYDWxBHzvAk2Z0n8R434FL1Rlv/Av18DXE43N/1rvHyOG4izKst0f2iSLdds">
17+
</script>
18+
</environment>

0 commit comments

Comments
 (0)