-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Very first commit (in the new repo).
- Loading branch information
0 parents
commit bd08cc4
Showing
120 changed files
with
45,015 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<solution> | ||
<add key="disableSourceControlIntegration" value="true" /> | ||
</solution> | ||
</configuration> |
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)\..\</SolutionDir> | ||
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath> | ||
<NuGetExePath>$(NuGetToolsPath)\nuget.exe</NuGetExePath> | ||
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig> | ||
<PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir> | ||
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir> | ||
|
||
<!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config --> | ||
<PackageSources>""</PackageSources> | ||
|
||
<!-- Enable the restore command to run before builds --> | ||
<RestorePackages Condition="$(RestorePackages) == ''">false</RestorePackages> | ||
|
||
<!-- Property that enables building a package from a project --> | ||
<BuildPackage Condition="$(BuildPackage) == ''">false</BuildPackage> | ||
|
||
<!-- Commands --> | ||
<RestoreCommand>"$(NuGetExePath)" install "$(PackagesConfig)" -source $(PackageSources) -o "$(PackagesDir)"</RestoreCommand> | ||
<BuildCommand>"$(NuGetExePath)" pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand> | ||
|
||
<!-- Make the build depend on restore packages --> | ||
<BuildDependsOn Condition="$(RestorePackages) == 'true'"> | ||
RestorePackages; | ||
$(BuildDependsOn); | ||
</BuildDependsOn> | ||
|
||
<!-- Make the build depend on restore packages --> | ||
<BuildDependsOn Condition="$(BuildPackage) == 'true'"> | ||
$(BuildDependsOn); | ||
BuildPackage; | ||
</BuildDependsOn> | ||
</PropertyGroup> | ||
|
||
<Target Name="CheckPrerequisites"> | ||
<!-- Raise an error if we're unable to locate nuget.exe --> | ||
<Error Condition="!Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" /> | ||
</Target> | ||
|
||
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites"> | ||
<Exec Command="$(RestoreCommand)" | ||
LogStandardErrorAsError="true" | ||
Condition="Exists('$(PackagesConfig)')" /> | ||
</Target> | ||
|
||
<Target Name="BuildPackage" DependsOnTargets="CheckPrerequisites"> | ||
<Exec Command="$(BuildCommand)" | ||
LogStandardErrorAsError="true" /> | ||
</Target> | ||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<TestSettings name="Local" id="fc7575a3-64a6-4a5b-a6c1-bf75703e836b" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010"> | ||
<Description>These are default test settings for a local test run.</Description> | ||
<Deployment enabled="false" /> | ||
<Execution> | ||
<TestTypeSpecific /> | ||
<AgentRule name="Execution Agents"> | ||
</AgentRule> | ||
</Execution> | ||
</TestSettings> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This project provides convenience extensions to the ASP.NET Web API framework. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProductVersion>8.0.30703</ProductVersion> | ||
<SchemaVersion>2.0</SchemaVersion> | ||
<ProjectGuid>{823DDCBC-F7BF-4AA6-A285-236FD482D40C}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>ContactManager.APIs</RootNamespace> | ||
<AssemblyName>ContactManager.APIs</AssemblyName> | ||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir> | ||
<RestorePackages>true</RestorePackages> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<DebugType>pdbonly</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>bin\Release\</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>True</Private> | ||
<HintPath>..\..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Net.Http.Formatting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<Private>True</Private> | ||
<HintPath>..\..\packages\System.Net.Http.Formatting.4.0.20126.16343\lib\net40\System.Net.Http.Formatting.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Net.Http.WebRequest, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"> | ||
<Private>True</Private> | ||
<HintPath>..\..\packages\System.Net.Http.2.0.20126.16343\lib\net40\System.Net.Http.WebRequest.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<Private>True</Private> | ||
<HintPath>..\..\packages\AspNetWebApi.Core.4.0.20126.16343\lib\net40\System.Web.Http.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Web.Http.Common, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<Private>True</Private> | ||
<HintPath>..\..\packages\System.Web.Http.Common.4.0.20126.16343\lib\net40\System.Web.Http.Common.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"> | ||
<Private>True</Private> | ||
<HintPath>..\..\packages\AspNetWebApi.4.0.20126.16343\lib\net40\System.Web.Http.WebHost.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="Microsoft.CSharp" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="ContactsController.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\ContactManager.Models\ContactManager.Models.csproj"> | ||
<Project>{A9E9CB97-9693-4311-A872-D710CB1EB060}</Project> | ||
<Name>ContactManager.Models</Name> | ||
</ProjectReference> | ||
<ProjectReference Include="..\..\Thinktecture.Web.Http\Thinktecture.Web.Http.csproj"> | ||
<Project>{915BB2DC-0A07-4DBB-802B-C299B3A492EC}</Project> | ||
<Name>Thinktecture.Web.Http</Name> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="packages.config" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<Import Project="$(SolutionDir)\.nuget\nuget.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</Target> | ||
--> | ||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Web.Http; | ||
using ContactManager.Models; | ||
using Thinktecture.Web.Http.Filters; | ||
|
||
namespace ContactManager.APIs | ||
{ | ||
// NOTE: Maybe it is not a good idea to expose the 'model' in the service/API. | ||
// Consider using use-case-based DTOs (http://davybrion.com/blog/2012/02/dtos-should-transfer-data-not-entities). | ||
public class ContactsController : ApiController | ||
{ | ||
private readonly IContactRepository repository; | ||
|
||
public ContactsController(IContactRepository repository) | ||
{ | ||
this.repository = repository; | ||
} | ||
|
||
[EnableCors] | ||
public IQueryable<Contact> Get() | ||
{ | ||
return repository.GetAll().AsQueryable(); | ||
} | ||
|
||
[EnableCors] | ||
public HttpResponseMessage<Contact> Get(int id) | ||
{ | ||
var contact = repository.Get(id); | ||
|
||
if (contact == null) | ||
{ | ||
var response = new HttpResponseMessage | ||
{ | ||
StatusCode = HttpStatusCode.NotFound, | ||
Content = new StringContent("Contact not found.") | ||
}; | ||
|
||
throw new HttpResponseException(response); | ||
} | ||
|
||
var contactResponse = new HttpResponseMessage<Contact>(contact); | ||
|
||
contactResponse.Content.Headers.Expires = new DateTimeOffset(DateTime.Now.AddSeconds(300)); | ||
|
||
return contactResponse; | ||
} | ||
|
||
public HttpResponseMessage<Contact> Post(Contact contact) | ||
{ | ||
repository.Post(contact); | ||
|
||
var response = new HttpResponseMessage<Contact>(contact) | ||
{ | ||
StatusCode = HttpStatusCode.Created | ||
}; | ||
response.Headers.Location = new Uri( | ||
ControllerContext.Request.RequestUri.LocalPath + "/" + contact.Id.ToString(CultureInfo.InvariantCulture), UriKind.Relative); | ||
|
||
return response; | ||
} | ||
|
||
public Contact Put(int id, Contact contact) | ||
{ | ||
repository.Get(id); | ||
repository.Update(contact); | ||
|
||
return contact; | ||
} | ||
|
||
public Contact Delete(int id) | ||
{ | ||
var deleted = repository.Get(id); | ||
repository.Delete(id); | ||
|
||
return deleted; | ||
} | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Reflection; | ||
using System.Runtime.CompilerServices; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("ContactManager.APIs")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("")] | ||
[assembly: AssemblyProduct("ContactManager.APIs")] | ||
[assembly: AssemblyCopyright("Copyright © 2012")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("6c5bcd45-70bc-4bcc-bc75-873519c3e2cb")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion("1.0.0.0")] | ||
[assembly: AssemblyFileVersion("1.0.0.0")] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="AspNetWebApi" version="4.0.20126.16343" /> | ||
<package id="AspNetWebApi.Core" version="4.0.20126.16343" /> | ||
<package id="System.Net.Http" version="2.0.20126.16343" /> | ||
<package id="System.Net.Http.Formatting" version="4.0.20126.16343" /> | ||
<package id="System.Web.Http.Common" version="4.0.20126.16343" /> | ||
</packages> |
Oops, something went wrong.