Files
CMS/src/CMSMicroservice.WebApi/Services/ProductGalleriesService.cs
T
masoodafar-web f0f48118e7 Add validators and services for Product Galleries and Product Tags
- Implemented Create, Delete, Get, and Update validators for Product Galleries.
- Added Create, Delete, Get, and Update validators for Product Tags.
- Created service classes for handling Discount Categories, Discount Orders, Discount Products, Discount Shopping Cart, Product Categories, Product Galleries, and Product Tags.
- Each service class integrates with CQRS for command and query handling.
- Established mapping profiles for Product Galleries.
2025-12-04 02:40:49 +03:30

38 lines
2.4 KiB
C#

using CMSMicroservice.Protobuf.Protos.ProductGalleries;
using CMSMicroservice.WebApi.Common.Services;
using CMSMicroservice.Application.ProductGalleriesCQ.Commands.CreateNewProductGalleries;
using CMSMicroservice.Application.ProductGalleriesCQ.Commands.UpdateProductGalleries;
using CMSMicroservice.Application.ProductGalleriesCQ.Commands.DeleteProductGalleries;
using CMSMicroservice.Application.ProductGalleriesCQ.Queries.GetProductGalleries;
using CMSMicroservice.Application.ProductGalleriesCQ.Queries.GetAllProductGalleriesByFilter;
namespace CMSMicroservice.WebApi.Services;
public class ProductGalleriesService : ProductGalleriesContract.ProductGalleriesContractBase
{
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
public ProductGalleriesService(IDispatchRequestToCQRS dispatchRequestToCQRS)
{
_dispatchRequestToCQRS = dispatchRequestToCQRS;
}
public override async Task<CreateNewProductGalleriesResponse> CreateNewProductGalleries(CreateNewProductGalleriesRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<CreateNewProductGalleriesRequest, CreateNewProductGalleriesCommand, CreateNewProductGalleriesResponse>(request, context);
}
public override async Task<Empty> UpdateProductGalleries(UpdateProductGalleriesRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<UpdateProductGalleriesRequest, UpdateProductGalleriesCommand>(request, context);
}
public override async Task<Empty> DeleteProductGalleries(DeleteProductGalleriesRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<DeleteProductGalleriesRequest, DeleteProductGalleriesCommand>(request, context);
}
public override async Task<GetProductGalleriesResponse> GetProductGalleries(GetProductGalleriesRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetProductGalleriesRequest, GetProductGalleriesQuery, GetProductGalleriesResponse>(request, context);
}
public override async Task<GetAllProductGalleriesByFilterResponse> GetAllProductGalleriesByFilter(GetAllProductGalleriesByFilterRequest request, ServerCallContext context)
{
return await _dispatchRequestToCQRS.Handle<GetAllProductGalleriesByFilterRequest, GetAllProductGalleriesByFilterQuery, GetAllProductGalleriesByFilterResponse>(request, context);
}
}