public void SaveContact(Contact contact) { ICollection<ValidationResult> validationResults; if (!contact.Validate(out validationResults)) { var ex = new ValidationException("The object did not pass the validation."); ex.Data.Add("ValidationResult", validationResults); throw ex; } if (contact.ContactId == 0) { ContactDAL.InsertContact(contact); } else { ContactDAL.UpdateContact(contact); } }
public void SaveContact(Contact contact) { ICollection <ValidationResult> validationResults; if (!contact.Validate(out validationResults)) { var ex = new ValidationException("The object did not pass the validation."); ex.Data.Add("ValidationResult", validationResults); throw ex; } if (contact.ContactId == 0) { ContactDAL.InsertContact(contact); } else { ContactDAL.UpdateContact(contact); } }