Files
CMS/src/CMSMicroservice.WebApi/Services/ProductGallerysService.cs
T
2025-11-12 02:24:02 +03:30

38 lines
2.4 KiB
C#

using CMSMicroservice.Protobuf.Protos.ProductGallerys;
using CMSMicroservice.WebApi.Common.Services;
using CMSMicroservice.Application.ProductGallerysCQ.Commands.CreateNewProductGallerys;
using CMSMicroservice.Application.ProductGallerysCQ.Commands.UpdateProductGallerys;
using CMSMicroservice.Application.ProductGallerysCQ.Commands.DeleteProductGallerys;
using CMSMicroservice.Application.ProductGallerysCQ.Queries.GetProductGallerys;
using CMSMicroservice.Application.ProductGallerysCQ.Queries.GetAllProductGallerysByFilter;
namespace CMSMicroservice.WebApi.Services;
public class ProductGallerysService : ProductGallerysContract.ProductGallerysContractBase
{
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
public ProductGallerysService(IDispatchRequestToCQRS dispatchRequestToCQRS)
{
_dispatchRequestToCQRS = dispatchRequestToCQRS;
}
public override async Task<CreateNewProductGallerysResponse> CreateNewProductGallerys(CreateNewProductGallerysRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<CreateNewProductGallerysRequest, CreateNewProductGallerysCommand, CreateNewProductGallerysResponse>(request, context);
}
public override async Task<Empty> UpdateProductGallerys(UpdateProductGallerysRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<UpdateProductGallerysRequest, UpdateProductGallerysCommand>(request, context);
}
public override async Task<Empty> DeleteProductGallerys(DeleteProductGallerysRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<DeleteProductGallerysRequest, DeleteProductGallerysCommand>(request, context);
}
public override async Task<GetProductGallerysResponse> GetProductGallerys(GetProductGallerysRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetProductGallerysRequest, GetProductGallerysQuery, GetProductGallerysResponse>(request, context);
}
public override async Task<GetAllProductGallerysByFilterResponse> GetAllProductGallerysByFilter(GetAllProductGallerysByFilterRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetAllProductGallerysByFilterRequest, GetAllProductGallerysByFilterQuery, GetAllProductGallerysByFilterResponse>(request, context);
}
}