Skip to content

Commit

Permalink
Added API Code
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDoy committed May 15, 2016
1 parent 706fe66 commit 6d9a048
Show file tree
Hide file tree
Showing 57 changed files with 31,220 additions and 5 deletions.
23 changes: 18 additions & 5 deletions .gitignore
Expand Up @@ -15,8 +15,9 @@
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Xx]64/
[Xx]86/
[Bb]uild/
bld/
[Bb]in/
[Oo]bj/
Expand Down Expand Up @@ -79,6 +80,7 @@ ipch/
*.opensdf
*.sdf
*.cachefile
*.VC.db

# Visual Studio profiler
*.psess
Expand Down Expand Up @@ -137,9 +139,11 @@ publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml

# TODO: Un-comment the next line if you do not want to checkin
# your web deploy settings because they may include unencrypted
# passwords
#*.pubxml
*.publishproj

# NuGet Packages
Expand Down Expand Up @@ -177,6 +181,7 @@ BundleArtifacts/

# Others
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
Expand Down Expand Up @@ -229,8 +234,16 @@ FakesAssemblies/
**/*.Server/ModelManifest.xml
_Pvt_Extensions

# LightSwitch generated files
GeneratedArtifacts/
ModelManifest.xml

# Paket dependency manager
.paket/paket.exe

# FAKE - F# Make
.fake/

#Remove Visual Studio 2015 Azure Publishing Files
*.pubxml
*.pubxml.user
22 changes: 22 additions & 0 deletions API/Itsp365.InvoiceFormApp.Api.sln
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Itsp365.InvoiceFormApp.Api", "Itsp365.InvoiceFormApp.Api\Itsp365.InvoiceFormApp.Api.csproj", "{60EFEE54-A030-4F9A-B617-E1CAEA49CBF2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{60EFEE54-A030-4F9A-B617-E1CAEA49CBF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{60EFEE54-A030-4F9A-B617-E1CAEA49CBF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{60EFEE54-A030-4F9A-B617-E1CAEA49CBF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{60EFEE54-A030-4F9A-B617-E1CAEA49CBF2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
31 changes: 31 additions & 0 deletions API/Itsp365.InvoiceFormApp.Api/App_Start/BundleConfig.cs
@@ -0,0 +1,31 @@
using System.Web;
using System.Web.Optimization;

namespace Itsp365.InvoiceFormApp.Api
{
public class BundleConfig
{
// For more information on bundling, visit http://go.microsoft.com/fwlink/?LinkId=301862
public static void RegisterBundles(BundleCollection bundles)
{
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));

bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.validate*"));

// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));

bundles.Add(new ScriptBundle("~/bundles/bootstrap").Include(
"~/Scripts/bootstrap.js",
"~/Scripts/respond.js"));

bundles.Add(new StyleBundle("~/Content/css").Include(
"~/Content/bootstrap.css",
"~/Content/site.css"));
}
}
}
13 changes: 13 additions & 0 deletions API/Itsp365.InvoiceFormApp.Api/App_Start/FilterConfig.cs
@@ -0,0 +1,13 @@
using System.Web;
using System.Web.Mvc;

namespace Itsp365.InvoiceFormApp.Api
{
public class FilterConfig
{
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
}
}
23 changes: 23 additions & 0 deletions API/Itsp365.InvoiceFormApp.Api/App_Start/RouteConfig.cs
@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Itsp365.InvoiceFormApp.Api
{
public class RouteConfig
{
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);
}
}
}
28 changes: 28 additions & 0 deletions API/Itsp365.InvoiceFormApp.Api/App_Start/Startup.Auth.cs
@@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IdentityModel.Tokens;
using System.Linq;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.ActiveDirectory;
using Owin;

namespace Itsp365.InvoiceFormApp.Api
{
public partial class Startup
{
// For more information on configuring authentication, please visit http://go.microsoft.com/fwlink/?LinkId=301864
public void ConfigureAuth(IAppBuilder app)
{
app.UseWindowsAzureActiveDirectoryBearerAuthentication(
new WindowsAzureActiveDirectoryBearerAuthenticationOptions
{
Tenant = ConfigurationManager.AppSettings["ida:Tenant"],
TokenValidationParameters = new TokenValidationParameters
{
ValidAudience = ConfigurationManager.AppSettings["ida:Audience"]
},
});
}
}
}
29 changes: 29 additions & 0 deletions API/Itsp365.InvoiceFormApp.Api/App_Start/WebApiConfig.cs
@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
using System.Web.Cors;
using System.Web.Http.Cors;

namespace Itsp365.InvoiceFormApp.Api
{
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
// Web API configuration and services
var corsConfiguration = new EnableCorsAttribute("http://localhost:8080,http://127.0.0.1:8080,https://itsp365invoiceformappapitest.azurewebsites.net", "*", "*");
config.EnableCors(corsConfiguration);


// Web API routes
config.MapHttpAttributeRoutes();

config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
}
}
}
24 changes: 24 additions & 0 deletions API/Itsp365.InvoiceFormApp.Api/Content/Site.css
@@ -0,0 +1,24 @@
body {
padding-top: 50px;
padding-bottom: 20px;
}

/* Set padding to keep content from hitting the edges */
.body-content {
padding-left: 15px;
padding-right: 15px;
}

/* Override the default bootstrap behavior where horizontal description lists
will truncate terms that are too long to fit in the left column
*/
.dl-horizontal dt {
white-space: normal;
}

/* Set width on the form input elements since they're 100% wide by default */
input,
select,
textarea {
max-width: 280px;
}

0 comments on commit 6d9a048

Please sign in to comment.