Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using AwsSecretStoreAspNetCore.Models;
using Microsoft.Extensions.Configuration;
using AwsSecretStoreAspNetCore.Models.Home;
namespace AwsSecretStoreAspNetCore.Controllers
{
public class HomeController : Controller
{
private readonly IConfiguration _config;
public HomeController(IConfiguration config)
{
_config = config;
}
public IActionResult Index()
{
var vm = new IndexViewModel
{
Secret = _config.GetValue<string>("test:ConnectionStrings:DATABASE"),
};
return View(vm);
}
public IActionResult Privacy()
{
return View();
}
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
public IActionResult Error()
{
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
}
}
}
@{
ViewData["Title"] = "Home Page";
}
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
<p>Secret: @Model.Secret</p>
</div>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace AwsSecretStoreAspNetCore.Models.Home
{
public class IndexViewModel
{
public string Secret { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.