Example #1
0
 public async Task CreateOrUpdateAttributeGroup(CreateAttributeGroupInput input)
 {
     if (input.Id != 0)
     {
         await UpdateAttributeGroup(input);
     }
     else
     {
         await CreateAttributeGroup(input);
     }
 }
Example #2
0
        public async Task CreateAttributeGroup(CreateAttributeGroupInput input)
        {
            var attributeGroup = input.MapTo <ProductAttributeGroup>();
            var val            = _attributeGroupRepository
                                 .GetAll().Where(u => u.AttributeGroupName == input.AttributeGroupName || u.AttributeGroupCode == input.AttributeGroupCode).FirstOrDefault();

            if (val == null)
            {
                await _attributeGroupRepository.InsertAsync(attributeGroup);
            }
            else
            {
                throw new UserFriendlyException("Ooops!", "Duplicate Data Occured in AttributeGroupName '" + input.AttributeGroupName + "' or AttributeGroupCode '" + input.AttributeGroupCode + "'...");
            }
        }