Skip to content

Commit 3aa72b2

Browse files
committed
added files for configuration
1 parent 0a81552 commit 3aa72b2

File tree

162 files changed

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

162 files changed

+51693
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
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 GeeksApp.Models;
8+
using GeeksConfiguration;
9+
10+
namespace GeeksApp.Controllers
11+
{
12+
public class HomeController : Controller
13+
{
14+
private readonly IGeekConfigManager _configuration;
15+
16+
public HomeController(IGeekConfigManager configuration)
17+
{
18+
this._configuration = configuration;
19+
}
20+
21+
public IActionResult Index()
22+
{
23+
string strEmail = this._configuration.EmailID;
24+
string strAccountKey = this._configuration.AccountKey;
25+
return View();
26+
}
27+
28+
public IActionResult About()
29+
{
30+
ViewData["Message"] = "Your application description page.";
31+
32+
return View();
33+
}
34+
35+
public IActionResult Contact()
36+
{
37+
ViewData["Message"] = "Your contact page.";
38+
39+
return View();
40+
}
41+
42+
public IActionResult Privacy()
43+
{
44+
return View();
45+
}
46+
47+
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
48+
public IActionResult Error()
49+
{
50+
return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
51+
}
52+
}
53+
}

GeeksApp/GeeksApp.csproj

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.2</TargetFramework>
5+
</PropertyGroup>
6+
7+
<ItemGroup>
8+
<PackageReference Include="Microsoft.AspNetCore.App" />
9+
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
10+
</ItemGroup>
11+
12+
<ItemGroup>
13+
<ProjectReference Include="..\GeeksConfiguration\GeeksConfiguration.csproj" />
14+
</ItemGroup>
15+
16+
</Project>

GeeksApp/Models/ErrorViewModel.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
3+
namespace GeeksApp.Models
4+
{
5+
public class ErrorViewModel
6+
{
7+
public string RequestId { get; set; }
8+
9+
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
10+
}
11+
}

GeeksApp/Program.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.Linq;
5+
using System.Threading.Tasks;
6+
using Microsoft.AspNetCore;
7+
using Microsoft.AspNetCore.Hosting;
8+
using Microsoft.Extensions.Configuration;
9+
using Microsoft.Extensions.Logging;
10+
11+
namespace GeeksApp
12+
{
13+
public class Program
14+
{
15+
public static void Main(string[] args)
16+
{
17+
CreateWebHostBuilder(args).Build().Run();
18+
}
19+
20+
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
21+
WebHost.CreateDefaultBuilder(args)
22+
.UseStartup<Startup>();
23+
}
24+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:50390",
7+
"sslPort": 44388
8+
}
9+
},
10+
"profiles": {
11+
"IIS Express": {
12+
"commandName": "IISExpress",
13+
"launchBrowser": true,
14+
"environmentVariables": {
15+
"ASPNETCORE_ENVIRONMENT": "Development"
16+
}
17+
},
18+
"GeeksApp": {
19+
"commandName": "Project",
20+
"launchBrowser": true,
21+
"applicationUrl": "https://localhost:5001;http://localhost:5000",
22+
"environmentVariables": {
23+
"ASPNETCORE_ENVIRONMENT": "Development"
24+
}
25+
}
26+
}
27+
}

GeeksApp/Startup.cs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Threading.Tasks;
5+
using Microsoft.AspNetCore.Builder;
6+
using Microsoft.AspNetCore.Hosting;
7+
using Microsoft.AspNetCore.Http;
8+
using Microsoft.AspNetCore.HttpsPolicy;
9+
using Microsoft.AspNetCore.Mvc;
10+
using Microsoft.Extensions.Configuration;
11+
using Microsoft.Extensions.DependencyInjection;
12+
using GeeksConfiguration;
13+
14+
namespace GeeksApp
15+
{
16+
public class Startup
17+
{
18+
public Startup(IConfiguration configuration)
19+
{
20+
Configuration = configuration;
21+
}
22+
23+
public IConfiguration Configuration { get; }
24+
25+
// This method gets called by the runtime. Use this method to add services to the container.
26+
public void ConfigureServices(IServiceCollection services)
27+
{
28+
services.Configure<CookiePolicyOptions>(options =>
29+
{
30+
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
31+
options.CheckConsentNeeded = context => true;
32+
options.MinimumSameSitePolicy = SameSiteMode.None;
33+
});
34+
35+
services.AddSingleton<IGeekConfigManager, GeekConfigManager>();
36+
37+
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
38+
}
39+
40+
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
41+
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
42+
{
43+
if (env.IsDevelopment())
44+
{
45+
app.UseDeveloperExceptionPage();
46+
}
47+
else
48+
{
49+
app.UseExceptionHandler("/Home/Error");
50+
app.UseHsts();
51+
}
52+
53+
app.UseHttpsRedirection();
54+
app.UseStaticFiles();
55+
app.UseCookiePolicy();
56+
57+
app.UseMvc(routes =>
58+
{
59+
routes.MapRoute(
60+
name: "default",
61+
template: "{controller=Home}/{action=Index}/{id?}");
62+
});
63+
}
64+
}
65+
}

GeeksApp/Views/Home/About.cshtml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
@{
2+
ViewData["Title"] = "About";
3+
}
4+
<h2>@ViewData["Title"]</h2>
5+
<h3>@ViewData["Message"]</h3>
6+
7+
<p>Use this area to provide additional information.</p>

GeeksApp/Views/Home/Contact.cshtml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
@{
2+
ViewData["Title"] = "Contact";
3+
}
4+
<h2>@ViewData["Title"]</h2>
5+
<h3>@ViewData["Message"]</h3>
6+
7+
<address>
8+
One Microsoft Way<br />
9+
Redmond, WA 98052-6399<br />
10+
<abbr title="Phone">P:</abbr>
11+
425.555.0100
12+
</address>
13+
14+
<address>
15+
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
16+
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
17+
</address>

GeeksApp/Views/Home/Index.cshtml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
@{
2+
ViewData["Title"] = "Home Page";
3+
}
4+
5+
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
6+
<ol class="carousel-indicators">
7+
<li data-target="#myCarousel" data-slide-to="0" class="active"></li>
8+
<li data-target="#myCarousel" data-slide-to="1"></li>
9+
<li data-target="#myCarousel" data-slide-to="2"></li>
10+
</ol>
11+
<div class="carousel-inner" role="listbox">
12+
<div class="item active">
13+
<img src="~/images/banner1.svg" alt="ASP.NET" class="img-responsive" />
14+
<div class="carousel-caption" role="option">
15+
<p>
16+
Learn how to build ASP.NET apps that can run anywhere.
17+
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525028&clcid=0x409">
18+
Learn More
19+
</a>
20+
</p>
21+
</div>
22+
</div>
23+
<div class="item">
24+
<img src="~/images/banner2.svg" alt="Visual Studio" class="img-responsive" />
25+
<div class="carousel-caption" role="option">
26+
<p>
27+
There are powerful new features in Visual Studio for building modern web apps.
28+
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525030&clcid=0x409">
29+
Learn More
30+
</a>
31+
</p>
32+
</div>
33+
</div>
34+
<div class="item">
35+
<img src="~/images/banner3.svg" alt="Microsoft Azure" class="img-responsive" />
36+
<div class="carousel-caption" role="option">
37+
<p>
38+
Learn how Microsoft's Azure cloud platform allows you to build, deploy, and scale web apps.
39+
<a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkID=525027&clcid=0x409">
40+
Learn More
41+
</a>
42+
</p>
43+
</div>
44+
</div>
45+
</div>
46+
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
47+
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
48+
<span class="sr-only">Previous</span>
49+
</a>
50+
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
51+
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
52+
<span class="sr-only">Next</span>
53+
</a>
54+
</div>
55+
56+
<div class="row">
57+
<div class="col-md-3">
58+
<h2>Application uses</h2>
59+
<ul>
60+
<li>Sample pages using ASP.NET Core MVC</li>
61+
<li>Theming using <a href="https://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
62+
</ul>
63+
</div>
64+
<div class="col-md-3">
65+
<h2>How to</h2>
66+
<ul>
67+
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398600">Add a Controller and View</a></li>
68+
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699315">Manage User Secrets using Secret Manager.</a></li>
69+
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699316">Use logging to log a message.</a></li>
70+
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699317">Add packages using NuGet.</a></li>
71+
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699319">Target development, staging or production environment.</a></li>
72+
</ul>
73+
</div>
74+
<div class="col-md-3">
75+
<h2>Overview</h2>
76+
<ul>
77+
<li><a href="https://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of what is ASP.NET Core</a></li>
78+
<li><a href="https://go.microsoft.com/fwlink/?LinkId=699320">Fundamentals of ASP.NET Core such as Startup and middleware.</a></li>
79+
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398602">Working with Data</a></li>
80+
<li><a href="https://go.microsoft.com/fwlink/?LinkId=398603">Security</a></li>
81+
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699321">Client side development</a></li>
82+
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699322">Develop on different platforms</a></li>
83+
<li><a href="https://go.microsoft.com/fwlink/?LinkID=699323">Read more on the documentation site</a></li>
84+
</ul>
85+
</div>
86+
<div class="col-md-3">
87+
<h2>Run &amp; Deploy</h2>
88+
<ul>
89+
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517851">Run your app</a></li>
90+
<li><a href="https://go.microsoft.com/fwlink/?LinkID=517853">Run tools such as EF migrations and more</a></li>
91+
<li><a href="https://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
92+
</ul>
93+
</div>
94+
</div>

GeeksApp/Views/Home/Privacy.cshtml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@{
2+
ViewData["Title"] = "Privacy Policy";
3+
}
4+
<h2>@ViewData["Title"]</h2>
5+
6+
<p>Use this page to detail your site's privacy policy.</p>

0 commit comments

Comments
 (0)