Changeset 9324 for branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/ExperimentController.cs
- Timestamp:
- 03/20/13 16:56:28 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS/HeuristicLab.Services.Optimization.Web/Controllers/ExperimentController.cs
r9305 r9324 14 14 { 15 15 [Authorize(Roles = "Web User")] 16 public class ExperimentController : Controller16 public class ExperimentController : BaseController 17 17 { 18 private ControllerServiceHelper ControllerService {19 get {20 var helper = new ControllerServiceHelper(Session["pw"] as string);21 if (!helper.Valid) {22 Response.Redirect("/Account/Logon?ReturnUrl=%2fExperiment");23 }24 return helper;25 }26 }27 28 18 // 29 19 // GET: /Experiment/ … … 31 21 public ActionResult Index() 32 22 { 33 return RedirectToAction("New"); 23 RedirectToLoginIfNecessary("%2fExperiment%2fIndex"); 24 return RedirectToAction("New", "Experiment"); 34 25 /*var model = new ExperimentViewModel(); 35 26 var scenarios = ControllerService.withControllerService<IEnumerable<string>>((service) => { … … 49 40 50 41 public ActionResult New() { 42 RedirectToLoginIfNecessary("%2fExperiment%2fNew"); 51 43 return View(); 52 44 } 53 45 54 46 public ActionResult NewEdit() { 47 RedirectToLoginIfNecessary("%2fExperiment%2fNewEdit"); 55 48 return View(); 56 49 } 50 57 51 58 52 public ActionResult Edit() { … … 65 59 model.Experiments.Add(experiment); 66 60 return View(model); 67 } 68 69 public ActionResult DeleteExperiment(string experiment) { 70 ControllerService.withControllerService<bool>((service) => { 71 User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string }; 72 return service.DeleteExperiment(u, experiment); 73 }); 74 return RedirectToAction("Edit"); 75 } 61 } 76 62 77 63 #region new experiment methdos … … 88 74 var experiments = ControllerService.withControllerService<IEnumerable<Experiment>>(service => { 89 75 User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string }; 90 return service.GetExperiments(u );76 return service.GetExperiments(u, namesOnly: true); 91 77 }); 92 78 return Content(AlgorithmConverter.ConvertExperimentsToJson(experiments).ToString(), "application/json", System.Text.Encoding.UTF8); … … 124 110 } 125 111 112 [HttpDelete] 113 [ActionName("Experiment")] 114 public JsonResult DeleteExperiment(string nodeId) { 115 var isExperimentDeleted = ControllerService.withControllerService<bool>(service => { 116 User u = new User() { Username = Membership.GetUser().UserName, Password = Session["pw"] as string }; 117 return service.DeleteExperiment(u, nodeId); 118 }); 119 return Json(isExperimentDeleted, JsonRequestBehavior.DenyGet); 120 } 126 121 127 122 [HttpGet]
Note: See TracChangeset
for help on using the changeset viewer.