Esempio n. 1
0
        public void InsertSupplier(Supplier supplier)
        {
            //ICollection<ValidationResult> validationResult;
               // if(!supplier.Validate(out validationResult))

            if(supplier.SupplierID==0)
            {
                SupplierDAL.InsertSupplier(supplier);
            }
            else
            {
               SupplierDAL.UpdateSupplier(supplier);
            }
        }
Esempio n. 2
0
        public void InsertSupplier(Supplier supplier)
        {
            //validering
            ICollection<ValidationResult> validationResult;
            if (!supplier.Validate(out validationResult))
            {
                var ex = new ValidationException("Leverantören klarade inte valideringen");
                ex.Data.Add("ValidationResult", validationResult);
                throw ex;
            }

            if(supplier.SupplierID==0)
            {
                SupplierDAL.InsertSupplier(supplier);
            }
            else
            {
               SupplierDAL.UpdateSupplier(supplier);
            }
        }