Skip to content
This repository was archived by the owner on Jan 23, 2020. It is now read-only.

Commit e7eee71

Browse files
committed
Initial
1 parent 55e491f commit e7eee71

File tree

592 files changed

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

592 files changed

+173640
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Microsoft.AspNet.Mvc;
2+
3+
// For more information on enabling MVC for empty projects, visit http://go.microsoft.com/fwlink/?LinkID=397860
4+
5+
namespace TodoListService.Controllers
6+
{
7+
public class HomeController : Controller
8+
{
9+
// GET: /<controller>/
10+
[HttpGet("/")]
11+
public IActionResult Index()
12+
{
13+
return View();
14+
}
15+
}
16+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Microsoft.AspNet.Mvc;
5+
using System.Security.Claims;
6+
using TodoListService.Models;
7+
using System.Collections.Concurrent;
8+
9+
namespace TodoListService.Controllers
10+
{
11+
[Authorize]
12+
[Route("api/[controller]")]
13+
public class TodoListController : Controller
14+
{
15+
static ConcurrentBag<TodoItem> todoStore = new ConcurrentBag<TodoItem>();
16+
17+
// GET: api/todolist
18+
[HttpGet]
19+
public IEnumerable<TodoItem> Get()
20+
{
21+
// Please note: use of "Context.User", instead of the standard ClaimsPrincipal.Current, is due to a bug in this release
22+
string owner = Context.User.FindFirst(ClaimTypes.NameIdentifier).Value;
23+
return todoStore.Where(t => t.Owner == owner).ToList();
24+
}
25+
26+
// POST api/todolist
27+
[HttpPost]
28+
public void Post(string Title)
29+
{
30+
// Please note: use of "Context.User", instead of the standard ClaimsPrincipal.Current, is due to a bug in this release
31+
string owner = Context.User.FindFirst(ClaimTypes.NameIdentifier).Value;
32+
todoStore.Add(new TodoItem { Owner = owner, Title = Title });
33+
}
34+
}
35+
}

TodoListService/Models/TodoItem.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
3+
namespace TodoListService.Models
4+
{
5+
public class TodoItem
6+
{
7+
public string Owner { get; set; }
8+
public string Title { get; set; }
9+
}
10+
}
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Welcome to ASP.NET 5</title>
6+
<style>
7+
html {
8+
background: #f1f1f1;
9+
height: 100%;
10+
}
11+
12+
body {
13+
background: #fff;
14+
color: #505050;
15+
font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
16+
margin: 1%;
17+
min-height: 95.5%;
18+
border: 1px solid silver;
19+
position: relative;
20+
}
21+
22+
#header {
23+
padding: 0;
24+
}
25+
26+
#header h1 {
27+
font-size: 44px;
28+
font-weight: normal;
29+
margin: 0;
30+
padding: 10px 30px 10px 30px;
31+
}
32+
33+
#header span {
34+
margin: 0;
35+
padding: 0 30px;
36+
display: block;
37+
}
38+
39+
#header p {
40+
font-size: 20px;
41+
color: #fff;
42+
background: #007acc;
43+
padding: 0 30px;
44+
line-height: 50px;
45+
margin-top: 25px;
46+
47+
}
48+
49+
#header p a {
50+
color: #fff;
51+
text-decoration: underline;
52+
font-weight: bold;
53+
padding-right: 35px;
54+
background: no-repeat right bottom url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAANlBMVEUAAAAAeswfitI9mthXp91us+KCvuaTx+mjz+2x1u+83PLH4vTR5/ba7Pjj8Pns9fv1+v3////wy3dWAAAAAXRSTlMAQObYZgAAAHxJREFUeNp9kVcSwCAIRMHUYoH7XzaxOxJ9P8oyQ1uIqNPwh3s2aLmIM2YtqrLcQIeQEylhuCeUOlhgve5yoBCfWmlnlgkN4H8ykbpaE7gR03AbUHiwoOxUH9Xp+ubd41p1HF3mBPrfC87BHeTdaB3ceeKL9HGpcvX9zu6+DdMWT9KQPvYAAAAASUVORK5CYII=);
55+
}
56+
57+
#main {
58+
padding: 5px 30px;
59+
clear: both;
60+
}
61+
62+
.section {
63+
width: 21.7%;
64+
float: left;
65+
margin: 0 0 0 4%;
66+
}
67+
68+
.section h2 {
69+
font-size: 13px;
70+
text-transform: uppercase;
71+
margin: 0;
72+
border-bottom: 1px solid silver;
73+
padding-bottom: 12px;
74+
margin-bottom: 8px;
75+
}
76+
77+
.section.first {
78+
margin-left: 0;
79+
}
80+
81+
.section.first h2 {
82+
font-size: 24px;
83+
text-transform: none;
84+
margin-bottom: 25px;
85+
border: none;
86+
}
87+
88+
.section.first li {
89+
border-top: 1px solid silver;
90+
padding: 8px 0;
91+
}
92+
93+
.section.last {
94+
margin-right: 0;
95+
}
96+
97+
ul {
98+
list-style: none;
99+
padding: 0;
100+
margin: 0;
101+
line-height: 20px;
102+
}
103+
104+
li {
105+
padding: 4px 0;
106+
}
107+
108+
a {
109+
color: #267cb2;
110+
text-decoration: none;
111+
}
112+
113+
a:hover {
114+
text-decoration: underline;
115+
}
116+
117+
#footer {
118+
clear: both;
119+
padding-top: 50px;
120+
}
121+
122+
#footer p {
123+
position: absolute;
124+
bottom: 10px;
125+
}
126+
</style>
127+
</head>
128+
<body>
129+
130+
<div id="header">
131+
<h1>Welcome to ASP.NET 5 Preview</h1>
132+
<span>
133+
We've made some big updates in this release, so it’s <b>important</b> that you spend
134+
a few minutes to learn what’s new.
135+
<br /><br />
136+
ASP.NET 5 has been rearchitected to make it <b>lean</b> and <b>composable</b>. It's fully
137+
<b>open source</b> and available on <a href="http://go.microsoft.com/fwlink/?LinkID=517854">GitHub</a>.
138+
<br />
139+
Your new project automatically takes advantage of modern client-side utilities
140+
like <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518005">npm</a>
141+
(to add client-side libraries) and <a href="http://go.microsoft.com/fwlink/?LinkId=518006">Grunt</a> and
142+
<a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> (for client-side build and automation tasks).
143+
144+
<br /><br />
145+
We hope you enjoy the new capabilities in ASP.NET 5 and Visual Studio 2015.
146+
<br />
147+
The ASP.NET Team
148+
</span>
149+
<p>You've created a new ASP.NET 5 project. <a href="http://go.microsoft.com/fwlink/?LinkId=518016">Learn what's new</a></p>
150+
</div>
151+
152+
<div id="main">
153+
<div class="section first">
154+
<h2>This application consists of:</h2>
155+
<ul>
156+
<li>Sample pages using ASP.NET MVC 6</li>
157+
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518006">Grunt</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side resources</li>
158+
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
159+
</ul>
160+
</div>
161+
162+
<div class="section">
163+
<h2>New concepts</h2>
164+
<ul>
165+
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">The 'wwwroot' explained</a></li>
166+
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518012">Configuration in ASP.NET 5</a></li>
167+
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518013">Dependency Injection</a></li>
168+
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518014">Razor TagHelpers</a></li>
169+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517849">Manage client packages using Grunt</a></li>
170+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517850">Develop on different platforms</a></li>
171+
</ul>
172+
</div>
173+
174+
<div class="section">
175+
<h2>Customize app</h2>
176+
<ul>
177+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add Controllers and Views</a></li>
178+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398602">Add Data using EntityFramework</a></li>
179+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398603">Add Authentication using Identity</a></li>
180+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398606">Add real time support using SignalR</a></li>
181+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398604">Add Class library</a></li>
182+
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518009">Add Web APIs with MVC 6</a></li>
183+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517848">Add client packages using Bower</a></li>
184+
</ul>
185+
</div>
186+
187+
<div class="section last">
188+
<h2>Deploy</h2>
189+
<ul>
190+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app locally</a></li>
191+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517852">Run your app on ASP.NET Core 5</a></li>
192+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run commands in your project.json</a></li>
193+
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Sites</a></li>
194+
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518019">Publish to the file system</a></li>
195+
</ul>
196+
</div>
197+
198+
<div id="footer">
199+
<p>We would love to hear your <a href="http://go.microsoft.com/fwlink/?LinkId=518015">feedback</a></p>
200+
</div>
201+
</div>
202+
203+
</body>
204+
</html>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"profiles": [
3+
{
4+
"name": "IIS Express",
5+
"launchBrowser": true,
6+
"launchUrl": "https://localhost:44321/"
7+
}
8+
]
9+
}

TodoListService/Startup.cs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
using System;
2+
using Microsoft.AspNet.Builder;
3+
using Microsoft.AspNet.Hosting;
4+
using Microsoft.AspNet.Http;
5+
using Microsoft.AspNet.Routing;
6+
using Microsoft.Framework.DependencyInjection;
7+
using Microsoft.Framework.ConfigurationModel;
8+
using Microsoft.AspNet.Security.OAuthBearer;
9+
using Microsoft.AspNet.Security;
10+
using System.IdentityModel.Tokens;
11+
using System.Collections.Generic;
12+
using System.Security.Claims;
13+
14+
namespace TodoListService
15+
{
16+
public class Startup
17+
{
18+
public Startup(IHostingEnvironment env)
19+
{
20+
// Setup configuration sources.
21+
Configuration = new Configuration()
22+
.AddJsonFile("config.json");
23+
}
24+
25+
public IConfiguration Configuration { get; set; }
26+
27+
// This method gets called by a runtime.
28+
// Use this method to add services to the container
29+
public void ConfigureServices(IServiceCollection services)
30+
{
31+
services.AddMvc();
32+
}
33+
34+
// Configure is called after ConfigureServices is called.
35+
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
36+
{
37+
// Configure the app to use OAuth Bearer Authentication
38+
app.UseOAuthBearerAuthentication(options =>
39+
{
40+
options.Audience = Configuration.Get("AzureAd:Audience");
41+
options.Authority = String.Format(Configuration.Get("AzureAd:AadInstance"), Configuration.Get("AzureAd:Tenant"));
42+
});
43+
44+
app.UseStaticFiles();
45+
// Add MVC to the request pipeline.
46+
app.UseMvc(routes =>
47+
{
48+
routes.MapRoute(
49+
name: "default",
50+
template: "{controller}/{action}/{id?}",
51+
defaults: new { controller = "Home", action = "Index" });
52+
});
53+
}
54+
}
55+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.Props" Condition="'$(VSToolsPath)' != ''" />
8+
<PropertyGroup Label="Globals">
9+
<ProjectGuid>299b1f6a-1bf6-4496-9770-463b2c318df5</ProjectGuid>
10+
<RootNamespace>TodoListService</RootNamespace>
11+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
12+
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
13+
</PropertyGroup>
14+
<PropertyGroup>
15+
<SchemaVersion>2.0</SchemaVersion>
16+
<DevelopmentServerPort>51896</DevelopmentServerPort>
17+
</PropertyGroup>
18+
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
19+
</Project>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8" />
5+
<title></title>
6+
</head>
7+
<body>
8+
Welcome to your ASP.NET 5 Web API app! Click <a href="api/Values"> here</a> to access the Web API api/values
9+
</body>
10+
</html>

TodoListService/config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"AzureAd": {
3+
"AadInstance": "https://login.windows.net/{0}",
4+
"Tenant": "[Enter tenant name, e.g. contoso.onmicrosoft.com]",
5+
"Audience": "[Enter App ID URI of TodoListService, e.g. https://contoso.onmicrosoft.com/TodoListService]"
6+
}
7+
}

0 commit comments

Comments
 (0)