using Microsoft.AspNetCore.Mvc; using PoweredSoft.CQRS.DynamicQuery.Abstractions; using PoweredSoft.DynamicQuery.Core; using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; namespace PoweredSoft.CQRS.DynamicQuery.AspNetCore.Mvc { [ApiController, Route("api/query/[controller]")] public class DynamicQueryController : Controller where TSource : class where TDestination : class { [HttpPost] public async Task> HandleAsync( [FromBody] DynamicQuery query, [FromServices]PoweredSoft.CQRS.Abstractions.IQueryHandler, IQueryExecutionResult> queryHandler ) { var result = await queryHandler.HandleAsync(query, HttpContext.RequestAborted); return result; } } [ApiController, Route("api/query/[controller]")] public class DynamicQueryController : Controller where TSource : class where TDestination : class where TParams : class { [HttpPost] public async Task> HandleAsync( [FromBody] DynamicQuery query, [FromServices] PoweredSoft.CQRS.Abstractions.IQueryHandler, IQueryExecutionResult> queryHandler ) { var result = await queryHandler.HandleAsync(query, HttpContext.RequestAborted); return result; } } }