コード例 #1
0
        public static int UpdateByPersonId(Person person)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (UpdatePersonByPersonIdCommand objectCommand = new UpdatePersonByPersonIdCommand(objectConnection))
                {
                    objectCommand.PersonId = person.PersonId;
                    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;
                }
            }
        }
コード例 #2
0
        public static int UpdateByPersonId(Guid personId, string firstName, string lastName, string phone, string email, int personTypeId)
        {
            using (ObjectConnection objectConnection = new ObjectConnection())
            {
                using (UpdatePersonByPersonIdCommand objectCommand = new UpdatePersonByPersonIdCommand(objectConnection))
                {
                    objectCommand.PersonId = personId;
                    objectCommand.PersonFirstName = firstName;
                    objectCommand.PersonLastName = lastName;
                    objectCommand.PersonPhone = phone;
                    objectCommand.PersonEmail = email;
                    objectCommand.PersonTypeId = personTypeId;

                    objectConnection.Open();
                    objectCommand.ExecuteNonQuery();

                    return objectCommand.ReturnValue;
                }
            }
        }