-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathNamed.cshtml.cs
More file actions
33 lines (28 loc) · 824 Bytes
/
Copy pathNamed.cshtml.cs
File metadata and controls
33 lines (28 loc) · 824 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using ScryfallApi.Client;
using ScryfallApi.Client.Models;
namespace ScryfallApi.WebSample.Pages
{
public class NamedModel : PageModel
{
ScryfallApiClient _scryfallApi { get; }
public Card NamedCard { get; set; }
[BindProperty]
public string Query { get; set; }
public NamedModel(ScryfallApiClient scryfallApi)
{
_scryfallApi = scryfallApi ?? throw new ArgumentNullException(nameof(scryfallApi));
}
public void OnGet()
{
}
public async Task<ActionResult> OnPostAsync()
{
NamedCard = await _scryfallApi.Cards.Named(Query, true);
return Page();
}
}
}