public ActionResult L2ABwHrWD(string L3A, string L3B, string Dir) { // Can't get the Route directive to work... ( try again with fresh project ) // needed to modify RouteConfig.cs, now it is called but not populating parameters. // needed to modify RouteConfig.cs to enable attribute routing (undo above replace with routes.MapMvcAttributeRoutes()) // working now, but some data has '&' in name that is causing exception outside of my code, perhaps better to avoid it // TBD more things to experiment // 1* use query strings to get paramaters, match exactly -- this works // 2. use run query to return results that equate to selected row add to model so it can populate the page title // pass multiple models back to view: http://www.codeproject.com/Articles/687061/Multiple-Models-in-a-View-in-ASP-NET-MVC-MVC // use the viewmodel approach: model containing two models with results for each query // 2* Existing parameters already a model, just needed to attach it to the model results // 3. pass keys and then use results for parameterizing the query by name, covering matching names for different partitions // debug hard-code sample parameters //L3A = "NE Florida Av & NE 8th St, Gallaudet University, Washington, DC 20002, USA"; //L3B = "Court House, Arlington, VA, USA"; //Dir = "A-B"; //construct unique names from passed parameters L3A = "[CentroidA].[Level3 Locality].&[" + L3A.Replace(".0a2n0d.", "&") + "]"; L3B = "[CentroidB].[Level3 Locality].&[" + L3B.Replace(".0a2n0d.", "&") + "]"; Dir = "[Direction].[Direction].&[" + Dir + "]"; //Debug, just hard code it //string L3A = "[CentroidA].[Level3 Locality].&[NE Florida Av & NE 8th St, Gallaudet University, Washington, DC 20002, USA]"; //string L3B = "[CentroidB].[Level3 Locality].&[Court House, Arlington, VA, USA]"; //string Dir = "[Direction].[Direction].&[A-B]"; //default constructor-less //L3ABwHrWDParams param = new L3ABwHrWDParams() // { // Direction = Dir, // Level3A = L3A, // Level3B = L3B // }; //L3ABwHrWDParams param = new L3ABwHrWDParams(L3A, L3B, Dir); L2ABwHrWDReport l2abwhrwdreport = new L2ABwHrWDReport(L3A, L3B, Dir); l2abwhrwdreport.GetData(); return View(l2abwhrwdreport); }
public ViewResult L2ABwHrWDPost(string Level3A, string Level3B, string Direction) { // need to decorate with unique name parts, unnecessary if unique name is in query if ((Level3A.Length < 32) || (Level3A.Substring(0, 32) != "[CentroidA].[Level3 Locality].&[")) { Level3A = "[CentroidA].[Level3 Locality].&[" + Level3A + "]"; } if ((Level3B.Length < 32) || (Level3B.Substring(0, 32) != "[CentroidB].[Level3 Locality].&[")) { Level3B = "[CentroidB].[Level3 Locality].&[" + Level3B + "]"; } if ((Direction.Length < 26) || (Direction.Substring(0, 26) != "[Direction].[Direction].&[")) { Direction = "[Direction].[Direction].&[" + Direction + "]"; } L2ABwHrWDReport l2abwhrwdreport = new L2ABwHrWDReport(Level3A, Level3B, Direction); l2abwhrwdreport.GetData(); return View("L2ABwHrWD", l2abwhrwdreport); }