Example #1
0
 public async Task CreateOrUpdateProductAttribute(CreateProductAttributeInput input)
 {
     if (input.Id != 0)
     {
         await UpdateProductAttribute(input);
     }
     else
     {
         await CreateProductAttribute(input);
     }
 }
Example #2
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 + "'...");
            }
        }