webmcp

view demo-app/app/main/media_type/_action/update.lua @ 567:5e3ebe9fd0ce

Added tag v2.2.1 for changeset 3b71fdb3a00d
author jbe
date Wed Apr 28 13:07:52 2021 +0200 (9 months ago)
parents 9fdfb27f8e67
children
line source
1 local media_type
2 local id = param.get_id()
3 if id then
4 media_type = MediaType:by_id(id)
5 else
6 media_type = MediaType:new()
7 end
9 if param.get("delete", atom.boolean) then
10 local name = media_type.name
11 media_type:destroy()
12 slot.put_into("notice", _("Media type '#{name}' deleted", {name = name}))
13 return
14 end
16 param.update(media_type, "name", "description")
18 media_type:save()
20 if id then
21 slot.put_into("notice", _("Media type '#{name}' updated", {name = media_type.name}))
22 else
23 slot.put_into("notice", _("Media type '#{name}' created", {name = media_type.name}))
24 end

Impressum / About Us