2017-10-11 18:27:05 +00:00
|
|
|
package models
|
|
|
|
|
2017-11-08 09:55:17 +00:00
|
|
|
// UpdatePublisher updates a publisher, takes an ID and a publisher struct with the new publisher infos
|
2017-11-07 15:35:10 +00:00
|
|
|
func UpdatePublisher(publisher Publisher, id int64) (newPublisher Publisher, err error) {
|
2017-10-11 18:27:05 +00:00
|
|
|
_, err = x.Where("id = ?", id).Update(&publisher)
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
return Publisher{}, err
|
|
|
|
}
|
|
|
|
|
|
|
|
// Get the newly updated publisher
|
|
|
|
newPublisher, _, err = GetPublisherByID(id)
|
|
|
|
|
|
|
|
return newPublisher, err
|
2017-11-07 15:35:10 +00:00
|
|
|
}
|