- Timestamp:
- Feb 16, 2010, 10:02:34 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/SiteDetailedController.groovy
r298 r360 3 3 @Secured(['ROLE_AppAdmin', 'ROLE_Manager', 'ROLE_AssetManager']) 4 4 class SiteDetailedController extends BaseController { 5 6 def siteService 5 7 6 8 // the delete, save and update actions only accept POST requests … … 29 31 @Secured(['ROLE_AppAdmin']) 30 32 def delete = { 31 def siteInstance = Site.get( params.id ) 32 if(siteInstance) { 33 try { 34 siteInstance.delete(flush:true) 35 flash.message = "Site ${params.id} deleted" 36 redirect(action:list) 37 } 38 catch(org.springframework.dao.DataIntegrityViolationException e) { 39 flash.message = "Site ${params.id} could not be deleted" 40 redirect(action:show,id:params.id) 41 } 33 def result = siteService.delete(params) 34 35 if(!result.error) { 36 flash.message = g.message(code: "default.delete.success", args: ["Site", params.id]) 37 redirect(action:list) 38 return 42 39 } 43 else { 44 flash.message = "Site not found with id ${params.id}" 40 41 flash.errorMessage = g.message(code: result.error.code, args: result.error.args) 42 43 if(result.error.code == "default.not.found") { 45 44 redirect(action:list) 45 return 46 46 } 47 48 redirect(action:show, id: params.id) 47 49 } 48 50
Note: See TracChangeset
for help on using the changeset viewer.