This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Startup | |
// This method gets called by the runtime. Use this method to add services to the container. | |
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940 | |
public Startup(IHostingEnvironment env) | |
{ | |
var builder = new ConfigurationBuilder() | |
.SetBasePath(env.ContentRootPath) | |
.AddJsonFile("appsettings.json", true, true) | |
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", true) | |
.AddEnvironmentVariables(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"ApplicationInsights": { | |
"InstrumentationKey": "ABC123" | |
}, | |
"ConnectionStrings": { | |
"DefaultConnection": "Server=BostonCreme\\donutfactorysecrets;Database=donutfactorydb;Trusted_Connection=True;MultipleActiveResultSets=true" | |
}, | |
"Logging": { | |
"IncludeScopes": false, | |
"LogLevel": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"publishOptions": { | |
"include": [ | |
"wwwroot", | |
"Views", | |
"web.config" | |
] | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"dotnet-test-xunit": "1.0.0-*", | |
"Microsoft.AspNetCore.TestHost": "1.0.0", | |
"Microsoft.NETCore.App": { | |
"type": "platform", | |
"version": "1.0.0" | |
}, | |
"Moq": "4.6.38-alpha", | |
"Newtonsoft.Json": "9.0.1", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StorageLocation | |
{ | |
public bool IsHardcover { get; set; } | |
public string LocationName { get; set; } | |
} | |
// My static storage data, for the purposes of this demo | |
private readonly List<StorageLocation> _locations = new List<StorageLocation>() | |
{ | |
new StorageLocation() { IsHardcover = true, LocationName = "General Circulation" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[HttpPost] | |
[ValidateAntiForgeryToken] | |
public IActionResult StorageLocations(bool isHardcover) | |
{ | |
var locations = _locations.Where(x => x.IsHardcover).ToList(); | |
return Json(locations); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form asp-controller="BookDetails" asp-action="BookDetail" id="bookForm" method="post"> | |
@Html.AntiForgeryToken() | |
<!-- all my other form controls would be somewhere in here --> | |
<fieldset> | |
<label asp-for="IsHardcover" class="label"></label> | |
<label class="select"> | |
<select asp-for="IsHardcover"> | |
<option value="true">Yes</option> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@section Scripts { | |
<script type="text/javascript"> | |
function determineStorageLocation() { | |
var token = $('input[name="__RequestVerificationToken"]', $('#bookForm')).val(); | |
var myData = { isHardcover: $("#IsHardcover").val() }; | |
var dataWithAntiforgeryToken = $.extend(myData, { '__RequestVerificationToken': token }); | |
$.ajax({ | |
url: "/BookDetails/StorageLocations", | |
type: "POST", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$csprojPath = $args[0] # path to the file i.e. 'C:\Users\ben\Code\csproj powershell\MySmallLibrary.csproj' | |
$newVersion = $args[1] # the build version, from VSTS build i.e. "1.1.20170323.1" | |
Write-Host "Starting process of generating new version number for the csproj" | |
$splitNumber = $newVersion.Split(".") | |
if( $splitNumber.Count -eq 4 ) | |
{ | |
$majorNumber = $splitNumber[0] | |
$minorNumber = $splitNumber[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Project Sdk="Microsoft.NET.Sdk"> | |
<PropertyGroup> | |
<TargetFramework>netstandard1.4</TargetFramework> | |
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | |
<Description>I entered a really nice description. This will show up later in my build</Description> | |
<Version>1.2.3.4</Version> | |
</PropertyGroup> | |
</Project> |
OlderNewer