- Timestamp:
- May 4, 2009, 1:59:11 PM (16 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/MaintenanceActionDetailedController.groovy
r122 r124 1 1 import org.codehaus.groovy.grails.plugins.springsecurity.Secured 2 2 3 class MaintenanceAction Controller extends BaseAppAdminController {3 class MaintenanceActionDetailedController extends BaseController { 4 4 5 5 def index = { redirect(action:list,params:params) } … … 82 82 83 83 def create = { 84 def maintenanceActionInstance = new MaintenanceAction() 85 maintenanceActionInstance.properties = params 86 return ['maintenanceActionInstance':maintenanceActionInstance] 84 try { 85 def plannedMaintenanceInstance = PlannedMaintenance.get(params.plannedMaintenanceInstance.id) 86 def maintenanceActionInstance = new MaintenanceAction() 87 maintenanceActionInstance.plannedMaintenance = plannedMaintenanceInstance 88 return ['maintenanceActionInstance':maintenanceActionInstance] 89 } 90 catch(Exception e) { 91 flash.message = "Please select a PlannedMaintenance, then 'Add action'" 92 redirect(controller:"plannedMaintenanceDetailed", action:"list") 93 } 87 94 } 88 95 … … 91 98 if(!maintenanceActionInstance.hasErrors() && maintenanceActionInstance.save()) { 92 99 flash.message = "MaintenanceAction ${maintenanceActionInstance.id} created" 93 redirect( action:show,id:maintenanceActionInstance.id)100 redirect(controller:"plannedMaintenanceDetailed", action:"show", id: params.plannedMaintenance.id) 94 101 } 95 102 else {
Note: See TracChangeset
for help on using the changeset viewer.