7
7
using System . ComponentModel . DataAnnotations ;
8
8
using System . Linq ;
9
9
using System . Net . Http ;
10
+ using System . Threading . Tasks ;
10
11
using System . Web . Http ;
11
12
using System . Web . Http . Results ;
12
13
@@ -147,7 +148,7 @@ public Check(Func<T, bool> checkFunc, string modelKey, string errorMsg)
147
148
}
148
149
149
150
[ Route ( "{realmName}" , Name = "PutRealmByName" ) ]
150
- public IHttpActionResult PutRealmByName ( string realmName , RealmDto newSettings )
151
+ public async Task < IHttpActionResult > PutRealmByName ( string realmName , RealmDto newSettings )
151
152
{
152
153
// TODO: use ETags for concurrency control
153
154
@@ -249,7 +250,7 @@ public IHttpActionResult PutRealmByName(string realmName, RealmDto newSettings)
249
250
return BadRequest ( ModelState ) ;
250
251
}
251
252
252
- var result = realmsService . TransactionalUpdate (
253
+ var result = await realmsService . TransactionalUpdate (
253
254
realm ,
254
255
r =>
255
256
{
@@ -320,7 +321,7 @@ private bool CompilerEqualsFactory(CompilerOptionsDto dto, RealmFactory factory)
320
321
}
321
322
322
323
[ Route ( "" , Name = "PostNewRealm" ) ]
323
- public IHttpActionResult PostNewRealm ( RealmDto newRealm )
324
+ public async Task < IHttpActionResult > PostNewRealm ( RealmDto newRealm )
324
325
{
325
326
// verify permission
326
327
if ( ! Request . CheckAccess ( GunchoResources . RealmActions . Create , GunchoResources . Realm , newRealm . Name ) )
@@ -359,7 +360,7 @@ public IHttpActionResult PostNewRealm(RealmDto newRealm)
359
360
}
360
361
361
362
// create the realm
362
- var realm = realmsService . CreateRealm ( playersService . GetPlayerByName ( User . Identity . Name ) , newRealm . Name , factory ) ;
363
+ var realm = await realmsService . CreateRealm ( playersService . GetPlayerByName ( User . Identity . Name ) , newRealm . Name , factory ) ;
363
364
364
365
if ( realm == null )
365
366
{
@@ -375,7 +376,7 @@ public IHttpActionResult PostNewRealm(RealmDto newRealm)
375
376
}
376
377
377
378
// invoke the PUT handler to update any other settings
378
- var innerResult = PutRealmByName ( newRealm . Name , newRealm ) as OkNegotiatedContentResult < RealmDto > ;
379
+ var innerResult = ( await PutRealmByName ( newRealm . Name , newRealm ) ) as OkNegotiatedContentResult < RealmDto > ;
379
380
380
381
if ( innerResult != null )
381
382
{
0 commit comments