public async Task <IActionResult> Handle(HttpRequest request, KeepSsAliveRequest data) { AuthByKeyPairResult authResult = this.GetAuthenticationKeyPair(request); if (!authResult.Result) { return(new JsonErrorResult(authResult.ErrorResponse)); } try { using (SqlConnection conn = sqlServer.GetConnection()) { await conn.OpenAsync(); using (SqlCommand cmd = sqlServer.GetSpCommand("dbo.Employee_KeepSecuredSessionAlive", conn)) { cmd.AddBinaryParam("@PermanentKey", 16, authResult.RegularKey.ToArray()); cmd.AddBinaryParam("@SecuredKey", 16, authResult.SecuredKey.ToArray()); SqlParameter retValParam = cmd.AddReturnValue(); await cmd.ExecuteNonQueryAsync(); int retVal = retValParam.GetInt32OrDefault(); if (retVal < 0) { ErrorResponse errorResponse = this.GetErrorResponse(retVal); return(new JsonErrorResult(errorResponse)); } return(new EmptyResult()); } } } catch (Exception ex) { return(new JsonErrorResult(this.GetExceptionResponse(ex))); } }
public async Task <ApiResponse> KeepSecuredSectionAlive(KeepSsAliveRequest data) { data.ClientInfo = this._clientInfo; return(await new ApiMethod <KeepSsAliveRequest, object>( this._httpClient, this._controllerUriPart, "KeepSsAlive", AuthHeaderKind.Secured).Call(data)); }
public async Task <IActionResult> KeepSecuredSectionAlive(KeepSsAliveRequest data) { return(await GetHandler <KeepSecuredSessionAlive>().Handle(this.Request, data)); }