f0f48118e7
- 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.
38 lines
2.4 KiB
C#
38 lines
2.4 KiB
C#
using CMSMicroservice.Protobuf.Protos.ProductCategory;
|
|
using CMSMicroservice.WebApi.Common.Services;
|
|
using CMSMicroservice.Application.ProductCategoryCQ.Commands.CreateNewProductCategory;
|
|
using CMSMicroservice.Application.ProductCategoryCQ.Commands.UpdateProductCategory;
|
|
using CMSMicroservice.Application.ProductCategoryCQ.Commands.DeleteProductCategory;
|
|
using CMSMicroservice.Application.ProductCategoryCQ.Queries.GetProductCategory;
|
|
using CMSMicroservice.Application.ProductCategoryCQ.Queries.GetAllProductCategoryByFilter;
|
|
namespace CMSMicroservice.WebApi.Services;
|
|
public class ProductCategoryService : ProductCategoryContract.ProductCategoryContractBase
|
|
{
|
|
private readonly IDispatchRequestToCQRS _dispatchRequestToCQRS;
|
|
|
|
public ProductCategoryService(IDispatchRequestToCQRS dispatchRequestToCQRS)
|
|
{
|
|
_dispatchRequestToCQRS = dispatchRequestToCQRS;
|
|
}
|
|
public override async Task<CreateNewProductCategoryResponse> CreateNewProductCategory(CreateNewProductCategoryRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<CreateNewProductCategoryRequest, CreateNewProductCategoryCommand, CreateNewProductCategoryResponse>(request, context);
|
|
}
|
|
public override async Task<Empty> UpdateProductCategory(UpdateProductCategoryRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<UpdateProductCategoryRequest, UpdateProductCategoryCommand>(request, context);
|
|
}
|
|
public override async Task<Empty> DeleteProductCategory(DeleteProductCategoryRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<DeleteProductCategoryRequest, DeleteProductCategoryCommand>(request, context);
|
|
}
|
|
public override async Task<GetProductCategoryResponse> GetProductCategory(GetProductCategoryRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<GetProductCategoryRequest, GetProductCategoryQuery, GetProductCategoryResponse>(request, context);
|
|
}
|
|
public override async Task<GetAllProductCategoryByFilterResponse> GetAllProductCategoryByFilter(GetAllProductCategoryByFilterRequest request, ServerCallContext context)
|
|
{
|
|
return await _dispatchRequestToCQRS.Handle<GetAllProductCategoryByFilterRequest, GetAllProductCategoryByFilterQuery, GetAllProductCategoryByFilterResponse>(request, context);
|
|
}
|
|
}
|