public async Task <IActionResult> Get(TKey id)
 {
     return(await AuthorizationThen(EntityControllerMethods.Get, async() =>
     {
         var context = ServiceProvider.GetRequiredService <KeyRequestContext <TKey> >();
         context.Key = id;
         var processor = FlowBundle.GetFlowProcessor(FlowKey + "." + EntityControllerMethods.Get);
         var output = await processor.Run(Request);
         return output;
     }));
 }
Example #2
0
 public async Task <IActionResult> Query(ODataQueryOptions <TEntity> oDataQueryOptions)
 {
     return(await AuthorizationThen(nameof(Query), async() =>
     {
         var context = ServiceProvider.GetRequiredService <OdataQueryRequestContext <TEntity> >();
         context.ODataQueryOptions = oDataQueryOptions;
         var processor = FlowBundle.GetFlowProcessor(FlowKey + "." + nameof(Query));
         var output = await processor.Run(Request);
         return output;
     }));
 }
 public async Task <IActionResult> Delete(TKey id)
 {
     return(await AuthorizationThen(EntityControllerMethods.Delete, async() =>
     {
         using (var scoep = GetScoep())
         {
             var context = ServiceProvider.GetRequiredService <KeyRequestContext <TKey> >();
             context.TransactionScope = scoep;
             context.Key = id;
             var processor = FlowBundle.GetFlowProcessor(FlowKey + "." + EntityControllerMethods.Delete);
             var output = await processor.Run(Request);
             scoep.Complete();
             return output;
         }
     }));
 }
 public async Task <IActionResult> Post([FromBody] TEntity value)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(GetValidationErrorObject()));
     }
     return(await AuthorizationThen(EntityControllerMethods.Post, async() =>
     {
         using (var scoep = GetScoep())
         {
             var context = ServiceProvider.GetRequiredService <InputRequestContext <TEntity> >();
             context.Input = value;
             context.TransactionScope = scoep;
             var processor = FlowBundle.GetFlowProcessor(FlowKey + "." + EntityControllerMethods.Post);
             var output = await processor.Run(Request);
             scoep.Complete();
             return output;
         }
     }));
 }