public ActionResult <InvokeResponse> Post(InvokeRequest request) => this.PolicyService.InvokePolicy.Execute( () => { try { using (var session = this.DatabaseService.Database.CreateSession()) { var acls = new WorkspaceAccessControlLists(session.GetUser()); var responseBuilder = new InvokeResponseBuilder(session, request, acls); var response = responseBuilder.Build(); return(response); } } catch (Exception e) { this.Logger.LogError(e, "InvokeRequest {request}", request); throw; } });
public IActionResult Invoke([FromBody] InvokeRequest invokeRequest) { try { return(this.PolicyService.InvokePolicy.Execute( () => { using (var session = this.DatabaseService.Database.CreateSession()) { var responseBuilder = new InvokeResponseBuilder(session, session.GetUser(), invokeRequest); var response = responseBuilder.Build(); return this.Ok(response); } })); } catch (Exception e) { this.Logger.LogError(e, "Exception"); return(this.StatusCode(500, e.Message)); } }
public InvokeResponseBuilder(ISession session, User user, InvokeRequest invokeRequest) { this.session = session; this.user = user; this.invokeRequest = invokeRequest; }