public static int Insert(Guid? personId, string firstName, string lastName, string phone, string email, int personTypeId) { using (ObjectConnection objectConnection = new ObjectConnection()) { using (InsertPersonCommand objectCommand = new InsertPersonCommand(objectConnection)) { objectCommand.PersonId = personId ?? new Guid(); objectCommand.PersonFirstName = firstName; objectCommand.PersonLastName = lastName; objectCommand.PersonPhone = phone; objectCommand.PersonEmail = email; objectCommand.PersonTypeId = personTypeId; objectConnection.Open(); objectCommand.ExecuteNonQuery(); return objectCommand.ReturnValue; } } }
public static int Insert(Person person) { using (ObjectConnection objectConnection = new ObjectConnection()) { using (InsertPersonCommand objectCommand = new InsertPersonCommand(objectConnection)) { objectCommand.PersonId = (person.PersonId != Guid.Empty) ? person.PersonId : new Guid(); objectCommand.PersonFirstName = person.PersonFirstName; objectCommand.PersonLastName = person.PersonLastName; objectCommand.PersonPhone = person.PersonPhone; objectCommand.PersonEmail = person.PersonEmail; objectCommand.PersonTypeId = person.PersonTypeId; objectConnection.Open(); objectCommand.ExecuteNonQuery(); return objectCommand.ReturnValue; } } }