public HttpResponseMessage GetListCategoryExtra(int catId, int storeId)
        {
            CategoryExtraMappingDomain  categoryExtraMappingDomain = new CategoryExtraMappingDomain();
            ProductCategoryDomain       categoryDomain             = new ProductCategoryDomain();
            ProductCategoryAPIViewModel Cat             = new ProductCategoryAPIViewModel();
            HttpResponseMessage         responseMessage = new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK
            };
            BaseResponse <ProductCategoryAPIViewModel> response = new BaseResponse <ProductCategoryAPIViewModel>();

            try
            {
                // get Extra mapping by PrimaryCategoryId
                var extra = categoryExtraMappingDomain.GetCategoryExtraMapping(catId, storeId);
                // get Category by ExtraCategoryId
                response = categoryDomain.GetCategoryByExtraId(extra.Data.ExtraCategoryId, storeId);
            }
            catch (ApiException e)
            {
                responseMessage.StatusCode = e.StatusCode;
                response = BaseResponse <ProductCategoryAPIViewModel> .Get(e.Success, e.ErrorMessage, null, e.ErrorStatus);
            }
            catch (Exception ex)
            {
                responseMessage.StatusCode = HttpStatusCode.InternalServerError;
                response = BaseResponse <ProductCategoryAPIViewModel> .Get(false, "ProductCategoryError : " + ex.ToString(), null, ResultEnum.InternalError);
            }
            responseMessage.Content = new JsonContent(response);
            return(responseMessage);
        }
        public HttpResponseMessage GetProductCategoriesByStoreId(CategoryRequest <string> request)
        {
            List <ProductCategoryAPIViewModel> productCategories = new List <ProductCategoryAPIViewModel>();
            HttpResponseMessage httpResponseMessage = new HttpResponseMessage()
            {
                StatusCode = HttpStatusCode.OK
            };
            BaseResponse <List <ProductCategoryAPIViewModel> > response = new BaseResponse <List <ProductCategoryAPIViewModel> >();

            try
            {
                ProductCategoryDomain domain = new ProductCategoryDomain();
                response = domain.GetProductCategoriesByRequest(request);
            }
            catch (ApiException e)
            {
                httpResponseMessage.StatusCode = e.StatusCode;
                response = BaseResponse <List <ProductCategoryAPIViewModel> > .Get(e.Success, e.ErrorMessage, null, e.ErrorStatus);
            }
            catch (Exception ex)
            {
                httpResponseMessage.StatusCode = HttpStatusCode.InternalServerError;
                response = BaseResponse <List <ProductCategoryAPIViewModel> > .Get(false, "ProductCategoryException: " + ex.ToString(), null, ResultEnum.InternalError);
            }
            httpResponseMessage.Content = new JsonContent(response);
            return(httpResponseMessage);
        }
        public Task ExecuteAsync(DeleteProductCategoryCommand command)
        {
            var productCategoryDomain = new ProductCategoryDomain(_writeService);

            productCategoryDomain.Delete(command.Id);

            _domainService.ApplyChanges(productCategoryDomain);
            return(Task.CompletedTask);
        }
        public Task ExecuteAsync(CreateProductCategoryCommand command)
        {
            var productCategoryDomain = new ProductCategoryDomain(_writeService);

            productCategoryDomain.Add(new ProductCategoryDto
            {
                Name = command.Name
            });

            _domainService.ApplyChanges(productCategoryDomain);
            return(Task.CompletedTask);
        }
        public Task ExecuteAsync(UpdateProductCategoryCommand command)
        {
            var productCategoryDomain = new ProductCategoryDomain(_domainService.WriteService);

            productCategoryDomain.Update(new ProductCategoryDto
            {
                Id   = command.Id,
                Name = command.Name
            });

            _domainService.ApplyChanges(productCategoryDomain);
            return(Task.CompletedTask);
        }