public IActionResult Post([FromBody] ProductAllowedColorTypeInsertCommandInputDTO model)
        {
            var appResult = this.InsertCommand.Execute(model);

            if (appResult.IsSucceed)
            {
                var signalArgs = new SignalREventArgs(SignalREvents.DATA_CHANGED.Identifier, nameof(SignalREvents.DATA_CHANGED.ActionEnum.ADDED_ITEM), nameof(ProductCategoryAllowedColorType), appResult.Bag);
                this.SignalRHubContext.Clients.All.DataChanged(signalArgs);
            }
            return(appResult.IsSucceed ? (IActionResult)this.Ok(appResult) : (IActionResult)this.BadRequest(appResult));
        }
        public OperationResponse <ProductAllowedColorTypeInsertCommandOutputDTO> Execute(ProductAllowedColorTypeInsertCommandInputDTO input)
        {
            var result = new OperationResponse <ProductAllowedColorTypeInsertCommandOutputDTO>();

            using (var dbContextScope = this.DbContextScopeFactory.Create())
            {
                var entity = new DomainModel.Product.ProductCategoryAllowedColorType
                {
                    ProductCategoryId  = input.ProductCategoryId,
                    ProductColorTypeId = input.ProductColorTypeId,
                };

                try
                {
                    var insertResult = this.Repository.Insert(entity);
                    result.AddResponse(insertResult);
                    if (result.IsSucceed)
                    {
                        dbContextScope.SaveChanges();
                    }
                }
                catch (Exception ex)
                {
                    result.AddError("Error Adding Product Allowed Color Type", ex);
                }

                if (result.IsSucceed)
                {
                    var getByIdResult = this.Repository.GetById(entity.Id);
                    result.AddResponse(getByIdResult);
                    if (result.IsSucceed)
                    {
                        result.Bag = new ProductAllowedColorTypeInsertCommandOutputDTO
                        {
                            Id = getByIdResult.Bag.Id,
                            ProductCategoryId  = getByIdResult.Bag.ProductCategoryId,
                            ProductColorTypeId = getByIdResult.Bag.ProductColorTypeId,
                        };
                    }
                }
            }

            return(result);
        }