Skip to content

Commit

Permalink
Added sample project
Browse files Browse the repository at this point in the history
  • Loading branch information
droyad committed Jul 17, 2017
1 parent 4cb6446 commit 074a09a
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 0 deletions.
70 changes: 70 additions & 0 deletions HighestCommon/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
*.*scc
*.FileListAbsolute.txt
*.aps
*.bak
*.[Cc]ache
*.clw
*.eto
*.fb6lck
*.fbl6
*.fbpInf
*.ilk
*.lib
*.log
*.ncb
*.nlb
*.obj
*.patch
*.pch
*.pdb
*.plg
*.[Pp]ublish.xml
*.rdl.data
*.sbr
*.scc
*.sig
*.sqlsuo
*.suo
*.svclog
*.tlb
*.tlh
*.tli
*.tmp
*.user
*.vshost.*
*DXCore.Solution
*_i.c
*_p.c
Ankh.Load
Backup*/
CVS/
PrecompiledWeb/
UpgradeLog*.*
[Bb]in/
[Dd]ebug/
[Oo]bj/
[Rr]elease/
[Tt]humbs.db
_UpgradeReport_Files
_[Rr]e[Ss]harper.*/
hgignore[.-]*
ignore[.-]*
svnignore[.-]*
lint.db
build
tools/TestResult.xml
*.ReSharper
source/packages
source/OctopusTools.v2.ncrunchsolution
*.orig
*.userprefs
*.lock.json
.vs
.vscode
/tools/
/artifacts/
/publish/
TestResult.xml
TestResults/
*.received.*
.idea/
24 changes: 24 additions & 0 deletions HighestCommon/Controllers/CalculateController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;

namespace HighestCommon.Controllers
{
[Route("/")]
public class CalculateController : Controller
{
[HttpGet("{a}/{b}")]
public int Get(int a, int b)
{
var max = Math.Min(a, b);
for (int x = max; x > 0; x--)
if (a % x == 0 && b % x == 0)
return x;

return 0;
}

}
}
20 changes: 20 additions & 0 deletions HighestCommon/HighestCommon.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Folder Include="wwwroot\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions HighestCommon/HighestCommon.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HighestCommon", "HighestCommon.csproj", "{8EFB664D-794A-4027-8C81-C6D56420DB07}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8EFB664D-794A-4027-8C81-C6D56420DB07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8EFB664D-794A-4027-8C81-C6D56420DB07}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8EFB664D-794A-4027-8C81-C6D56420DB07}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8EFB664D-794A-4027-8C81-C6D56420DB07}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
26 changes: 26 additions & 0 deletions HighestCommon/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;

namespace HighestCommon
{
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
.UseApplicationInsights()
.Build();

host.Run();
}
}
}
29 changes: 29 additions & 0 deletions HighestCommon/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:63158/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"HighestCommon": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "api/values",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:63159"
}
}
}
43 changes: 43 additions & 0 deletions HighestCommon/Startup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace HighestCommon
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true)
.AddEnvironmentVariables();
Configuration = builder.Build();
}

public IConfigurationRoot Configuration { get; }

// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddMvc();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();

app.UseMvc();
}
}
}
10 changes: 10 additions & 0 deletions HighestCommon/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Debug",
"System": "Information",
"Microsoft": "Information"
}
}
}
8 changes: 8 additions & 0 deletions HighestCommon/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Warning"
}
}
}

0 comments on commit 074a09a

Please sign in to comment.