public void InsertSupplier(Supplier supplier) { //ICollection<ValidationResult> validationResult; // if(!supplier.Validate(out validationResult)) if(supplier.SupplierID==0) { SupplierDAL.InsertSupplier(supplier); } else { SupplierDAL.UpdateSupplier(supplier); } }
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); } }