Skip to content

Commit ad5b96b

Browse files
author
Chris Martinez
committed
Corrected route template defaults and comments for API versioning by namespace sample
1 parent 5f7df92 commit ad5b96b

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

samples/webapi/ByNamespaceWebApiSample/Startup.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ public void Configuration( IAppBuilder builder )
2121
configuration.Routes.MapHttpRoute(
2222
"VersionedQueryString",
2323
"api/{controller}/{accountId}",
24-
new { accountId = Optional } );
24+
defaults: null );
2525

2626
configuration.Routes.MapHttpRoute(
2727
"VersionedUrl",
2828
"v{apiVersion}/{controller}/{accountId}",
29-
new { accountId = Optional },
30-
new { apiVersion = new ApiVersionRouteConstraint() } );
29+
defaults: null,
30+
constraints: new { apiVersion = new ApiVersionRouteConstraint() } );
3131

3232
builder.UseWebApi( httpServer );
3333
}

samples/webapi/ByNamespaceWebApiSample/V1/Controllers/AgreementsController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
[ApiVersion( "1.0" )]
99
public class AgreementsController : ApiController
1010
{
11-
// GET ~/v1/agreements
12-
// GET ~/agreements?api-version=1.0
11+
// GET ~/v1/agreements/{accountId}
12+
// GET ~/agreements/{accountId}?api-version=1.0
1313
public IHttpActionResult Get( string accountId ) => Ok( new Agreement( GetType().FullName, accountId, Request.GetRequestedApiVersion().ToString() ) );
1414
}
1515
}

samples/webapi/ByNamespaceWebApiSample/V2/Controllers/AgreementsController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
[ApiVersion( "2.0" )]
99
public class AgreementsController : ApiController
1010
{
11-
// GET ~/v2/agreements
12-
// GET ~/agreements?api-version=2.0
11+
// GET ~/v2/agreements/{accountId}
12+
// GET ~/agreements/{accountId}?api-version=2.0
1313
public IHttpActionResult Get( string accountId ) => Ok( new Agreement( GetType().FullName, accountId, Request.GetRequestedApiVersion().ToString() ) );
1414
}
1515
}

samples/webapi/ByNamespaceWebApiSample/V3/Controllers/AgreementsController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
[ApiVersion( "3.0" )]
99
public class AgreementsController : ApiController
1010
{
11-
// GET ~/v3/agreements
12-
// GET ~/agreements?api-version=3.0
11+
// GET ~/v3/agreements/{accountId}
12+
// GET ~/agreements/{accountId}?api-version=3.0
1313
public IHttpActionResult Get( string accountId ) => Ok( new Agreement( GetType().FullName, accountId, Request.GetRequestedApiVersion().ToString() ) );
1414
}
1515
}

0 commit comments

Comments
 (0)