Exemple #1
0
        protected virtual async Task ValidateVendorPaymentTermUnitAsync(VendorPaymentTermUnit vendorpaymentUnit)
        {
            //Validating if Duplicate VendorPaymentTem exists
            if (VendorPaymentTermUnitRepository != null)
            {
                var vendorPaymentTermunit = (await VendorPaymentTermUnitRepository.GetAllListAsync(p => p.Description == vendorpaymentUnit.Description && p.OrganizationUnitId == vendorpaymentUnit.OrganizationUnitId));

                if (vendorpaymentUnit.Id == 0)
                {
                    if (vendorPaymentTermunit.Count > 0)
                    {
                        throw new UserFriendlyException(L("Duplicate VendorPaymentTem", vendorpaymentUnit.Description));
                    }
                }
                else
                {
                    if (vendorPaymentTermunit.FirstOrDefault(p => p.Id != vendorpaymentUnit.Id && p.Description == vendorpaymentUnit.Description) != null)
                    {
                        throw new UserFriendlyException(L("Duplicate VendorPaymentTem", vendorpaymentUnit.Description));
                    }
                }
            }
        }
Exemple #2
0
        public virtual async Task UpdateAsync(VendorPaymentTermUnit vendorPaymentTermUnit)
        {
            await ValidateVendorPaymentTermUnitAsync(vendorPaymentTermUnit);

            await VendorPaymentTermUnitRepository.UpdateAsync(vendorPaymentTermUnit);
        }