Beispiel #1
0
 public async Task CreateOrUpdateProductSubGroup(CreateProductSubGpInput input)
 {
     if (input.Id != 0)
     {
         await UpdateProductSubGroup(input);
     }
     else
     {
         await CreateProductSubGroup(input);
     }
 }
Beispiel #2
0
        public async Task CreateProductSubGroup(CreateProductSubGpInput input)
        {
            using (_unitOfWorkManager.Current.SetTenantId(_session.TenantId))
            {
                input.TenantId = (int)_session.TenantId;
                var productsubgroup = input.MapTo <ProductSubGroup>();
                var val             = _productSubGroupRepository
                                      .GetAll().Where(u => u.ProductSubGroupName == input.ProductSubGroupName || u.ProductSubGroupCode == input.ProductSubGroupCode).FirstOrDefault();

                if (val == null)
                {
                    await _productSubGroupRepository.InsertAsync(productsubgroup);
                }
                else
                {
                    throw new UserFriendlyException("Ooops!", "Duplicate Data Occured in ProductSubGroupName '" + input.ProductSubGroupName + "' or ProductSubGroupCode '" + input.ProductSubGroupCode + "'...");
                }
            }
        }