Go To Application Folder (Layer) And Create Command Or Query and Use down Code in Application Layer .
You should use "IRequest" for command and query requests , like this :
Sample Command And CommandHandler
// Use IRequest In Command ModelpublicclassCreateProductCommand:IRequest{publicstringProductTitle{get;set;}publicstringProductName{get;set;}}// Use IRequestHandler In Command HandlerpublicclassCreateProductCommandHandler:IRequestHandler<CreateProductCommand>{publicasyncTask<Unit>Handle(CreateProductCommandrequest,CancellationTokencancellationToken){varcreateProductDto= GenereateCreateProductDtoFromaCommand(request);await _productService.CreateProduct(createProductDto).ConfigureAwait(false);return Unit.Value;}}
Sample Query And QueryHandler
// Use IRequest In Query Model publicclassGetProductQuery:IRequest<IEnumerable<ProductVM>>{publicintProductId{get;set;}}// Use IRequest In Query HandlerpublicclassGetProductQueryHandler:IRequestHandler<GetProductQuery,IEnumerable<ProductVM>>{publicasyncTask<IEnumerable<ProductVM>>Handle(GetProductQueryrequest,CancellationTokencancellationToken){varproductVMList=await _productService.GetProduct().ConfigureAwait(false);returnproductVMList;}}
About
Separating commands and queries in User Mediator In .Net 6