Example #1
0
        public async Task CreateProductAttribute(CreateProductAttributeInput input)
        {
            var attribute = input.MapTo <ProductAttribute>();
            var val       = _productAttributeRepository
                            .GetAll().Where(p => p.AttributeCode == input.AttributeCode || p.AttributeName == input.AttributeName).FirstOrDefault();

            if (val == null)
            {
                await _productAttributeRepository.InsertAsync(attribute);
            }
            else
            {
                throw new UserFriendlyException("Ooops!", "Duplicate Data Occured in AttributeCode '" + input.AttributeCode + "' or AttributeName '" + input.AttributeName + "'...");
            }
        }