public OperationResponse Delete(DomainModel.Product.ProductCategoryAllowedSize entity)
        {
            var result = new OperationResponse();

            var dbLocator = this.AmbientDbContextLocator.Get <RiverdaleDBContext>();

            try
            {
                dbLocator.Set <ProductCategoryAllowedSize>().Remove(entity);
            }
            catch (Exception ex)
            {
                result.AddException("Error deleting Product Color Type", ex);
            }

            return(null);
        }
        public OperationResponse <ProductCategoryAllowedSizeInsertCommandOutputDTO> Execute(ProductCategoryAllowedSizeInsertCommandInputDTO input)
        {
            var result = new OperationResponse <ProductCategoryAllowedSizeInsertCommandOutputDTO>();

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

                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 ProductCategoryAllowedSizeInsertCommandOutputDTO
                        {
                            Id = getByIdResult.Bag.Id,
                            ProductCategoryId = getByIdResult.Bag.ProductCategoryId,
                            Size = getByIdResult.Bag.Size,
                        };
                    }
                }
            }

            return(result);
        }