public ActionResult Edit(Mapper m, string action) { switch (action) { case "delete": // delete action break; case "save": // save action short_variable_vw sv = micadb.short_variable_vw.Where(o => o.nid.ToString() == m.selection.selectedTargetVariableId.ToString()).First(); m.selection.selectedTarget = sv; break; } return(View("Index", m)); }
// GET: Mapper public ActionResult Index(short_variable_vw target, List <short_variable_vw> cohorts) { // in future versions, we may come to this page with parameters, but at this time we expect nulls Mapper m = new Mapper(); // if parameters are null, show existing maps if (!string.IsNullOrEmpty(target.dataset_name) && cohorts.Count != 0) { //m = new Mapper { selectedTargetVariableId = target, selectedCohorts = cohorts };// new List<Cohort> { new Cohort { Id = 885 }, new Cohort { Id = 888 }, new Cohort { Id = 890 } } }; } else { return(RedirectToAction("GetMapInput")); // prompt for whatever is missing and create Mapper //m = null; //m = new Mapper { selectedTargetVariableId = "800", selectedCohortIds = new List<Cohort> { new Cohort { Id = 885 }, new Cohort { Id = 888 }, new Cohort { Id = 890 } } }; } return(View(m)); }