- Timestamp:
- 04/24/13 13:40:43 (12 years ago)
- Location:
- branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/AdminController.cs
r9215 r9395 34 34 public ActionResult Index() 35 35 { 36 var names = ControllerService.withControllerService<IEnumerable< string>>((service) => {36 var names = ControllerService.withControllerService<IEnumerable<ScenarioModel>>((service) => { 37 37 User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string }; 38 return service.GetOptimizationScenarioNames(); 38 var scenModel = new List<ScenarioModel>(); 39 var scenarios = service.GetOptimizationScenarioNames(); 40 foreach (var scenario in scenarios) { 41 scenModel.Add(new ScenarioModel() { Exists = service.ExistsVisualExtension(scenario), Scenario = scenario }); 42 } 43 return scenModel; 39 44 }); 40 45 return View(names); … … 65 70 } 66 71 72 [HttpPost] 73 public ActionResult AddVisualExtension(UploadVisualExtension extension) { 74 StreamReader reader = new StreamReader(extension.ScenarioJs.InputStream); 75 string scenarioJs = reader.ReadToEnd(); 76 77 var ok = ControllerService.withControllerService<bool>((service) => { 78 OptimizationModel model = new OptimizationModel(); 79 User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string }; 80 return service.AddVisualExtension(extension.ScenarioId, scenarioJs); 81 }); 82 return RedirectToAction("Index"); 83 } 84 85 [HttpPost] 86 public ActionResult DeleteVisualExtension(UploadVisualExtension extension) { 87 var ok = ControllerService.withControllerService<bool>((service) => { 88 OptimizationModel model = new OptimizationModel(); 89 User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string }; 90 return service.DeleteVisualExtension(extension.ScenarioId); 91 }); 92 return RedirectToAction("Index"); 93 } 94 67 95 public ActionResult DeleteScenario(string id) { 68 96 ControllerService.withControllerService<bool>((service) => { -
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/JobController.cs
r9362 r9395 59 59 60 60 [HttpGet] 61 public ActionResult VisualExtension(string algorithmId) {62 var script = ControllerService.withControllerService<string>((service) => {61 public JsonResult VisualExtension(string scenarioId) { 62 var extension = ControllerService.withControllerService<VisualExtension>((service) => { 63 63 User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string }; 64 return service.GetVisualExtension( algorithmId);64 return service.GetVisualExtension(scenarioId); 65 65 }); 66 return Content(script, "text/javascript", System.Text.Encoding.UTF8);66 return Json(extension, JsonRequestBehavior.AllowGet); 67 67 } 68 68 }
Note: See TracChangeset
for help on using the changeset viewer.