Skip to content

Instantly share code, notes, and snippets.

@guitarrapc
Created May 1, 2019 20:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guitarrapc/e74126fa96d49825aff28db067766a41 to your computer and use it in GitHub Desktop.
Save guitarrapc/e74126fa96d49825aff28db067766a41 to your computer and use it in GitHub Desktop.
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