rendered paste bodydef updateUser(params) {
log.debug "Called createUser with ${params}"
def person = personDAO.findById(params.personId)
person.firstName = params.firstName
person.lastName = params.lastName
person.telephone = params.telephone
person.mobile = params.mobile
person = personDAO.makePersistent(person)
personDAO.flush()
return person
}
/**
* The definition for the updateUser method validations.
*/
def updateUser_constraints = {
personId(nullable: false, minValue: 0, maxValue: Long.MAX_VALUE, type: Long)
firstName(nullable:true, type: String)
lastName(nullable:true, type: String)
telephone(nullable: true, type: String)
mobile(nullable: true, type: String)
}
============================>>
def updateUser(params) {
log.debug "Called createUser with ${params}"
def person = personDAO.findById(params.personId)
person.firstName = params.firstName ?: person.firstName
person.lastName = params.lastName ?: person.lastName
person.telephone = params.telephone ?: person.telephone
person.mobile = params.mobile ?: person.mobile
person = personDAO.makePersistent(person)
personDAO.flush()
return person
}
/**
* The definition for the updateUser method validations.
*/
def updateUser_constraints = {
personId(nullable: false, minValue: 0, maxValue: Long.MAX_VALUE, type: Long)
firstName(nullable: false, blank: false, type: String)
lastName(nullable: false, blank: false, type: String)
telephone(nullable: true, type: String)
mobile(nullable: true, type: String)
}