Permalink
Browse files

Hook up to the UI

  • Loading branch information...
scottsauber committed Jul 7, 2018
1 parent a3d4f7f commit 825aef7e5300e637e2133b45b2422aa479d1388e
@@ -1,17 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using RazorHtmlEmails.Common;
namespace RazorHtmlEmails.AspNetCore.Pages
{
public class IndexModel : PageModel
{
public void OnGet()
private readonly IRegisterAccountService _registerAccountService;
public IndexModel(IRegisterAccountService registerAccountService)
{
_registerAccountService = registerAccountService;
}
public async Task<IActionResult> OnGetAsync()
{
// In reality, you would have this on a POST and pass along user input and not just have the Confirm Account link be the Index page... but #Demoware
await _registerAccountService.Register("testmctestyface@contoso.com", Url.Page("./Index"));
return Page();
}
}
}
@@ -8,4 +8,8 @@
<PackageReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\RazorHtmlEmails.Common\RazorHtmlEmails.Common.csproj" />
</ItemGroup>
</Project>
@@ -9,6 +9,8 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using RazorHtmlEmails.Common;
using RazorHtmlEmails.RazorClassLib.Services;
namespace RazorHtmlEmails.AspNetCore
{
@@ -31,6 +33,8 @@ public void ConfigureServices(IServiceCollection services)
options.MinimumSameSitePolicy = SameSiteMode.None;
});
services.AddScoped<IRegisterAccountService, RegisterAccountService>();
services.AddScoped<IRazorViewToStringRenderer, RazorViewToStringRenderer>();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
}

0 comments on commit 825aef7

Please sign in to comment.