11using System . Linq ;
22using System . Web . Mvc ;
3+ using Alexr03 . Common . TCAdmin . Web . Binders ;
34using Alexr03 . Common . Web . Helpers ;
45using Newtonsoft . Json . Linq ;
5- using TCAdmin . SDK . Objects ;
66using TCAdmin . SDK . VirtualFileSystem ;
77using TCAdmin . SDK . Web . FileManager ;
88using TCAdmin . SDK . Web . MVC . Controllers ;
@@ -17,14 +17,13 @@ public ActionResult Configuration()
1717 {
1818 return View ( ) ;
1919 }
20-
20+
2121 [ ParentAction ( "Configuration" ) ]
22- public ActionResult ConfigureCron ( int id )
22+ public ActionResult ConfigureCron ( [ DynamicTypeBaseBinder ] CronJob cronJob )
2323 {
24- var cronJob = new CronJob ( id ) ;
25- TempData [ "id" ] = id ;
24+ TempData [ "id" ] = cronJob . Id ;
2625 TempData [ "repeatEvery" ] = cronJob . ExecuteEverySeconds ;
27- var configurationJObject = ( JObject ) cronJob . Configuration . Parse < object > ( ) ;
26+ var configurationJObject = cronJob . Configuration . Parse < JObject > ( ) ;
2827 var o = configurationJObject . ToObject ( cronJob . Configuration . Type ) ;
2928 ViewData . TemplateInfo = new TemplateInfo
3029 {
@@ -35,12 +34,11 @@ public ActionResult ConfigureCron(int id)
3534
3635 [ HttpPost ]
3736 [ ParentAction ( "Configuration" ) ]
38- public ActionResult ConfigureCron ( int id , FormCollection model )
37+ public ActionResult ConfigureCron ( [ DynamicTypeBaseBinder ] CronJob cronJob , FormCollection model )
3938 {
40- var cronJob = new CronJob ( id ) ;
4139 cronJob . ExecuteEverySeconds = int . Parse ( Request [ $ "{ cronJob . Configuration . Type . Name } .repeatEvery"] ) ;
4240 cronJob . Save ( ) ;
43- TempData [ "id" ] = id ;
41+ TempData [ "id" ] = cronJob . Id ;
4442 TempData [ "repeatEvery" ] = cronJob . ExecuteEverySeconds ;
4543 var bindModel = model . Parse ( ControllerContext , cronJob . Configuration . Type ) ;
4644 cronJob . Configuration . SetConfiguration ( bindModel ) ;
0 commit comments